SOLVED

Excel Formula for Post Code Area

%3CLINGO-SUB%20id%3D%22lingo-sub-2425287%22%20slang%3D%22en-US%22%3EExcel%20Formula%20for%20Post%20Code%20Area%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2425287%22%20slang%3D%22en-US%22%3E%3CP%3EI%20hope%20someone%20can%20help.%26nbsp%3B%20I%20have%20a%20formula%20to%20return%20the%20first%20section%20of%20a%20UK%20Post%20Code%20(column%20C%20in%20the%20attached%20file)%20and%20using%20this%20I%20want%20to%20create%20an%20IF%20Statement%20to%20assign%20the%20related%20area%20(Column%20D%20in%20the%20attached%20file).%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20example%20if%20Column%20C%20contains%20either%20CA12%20%2C%20CA13%2C%20CA14%20etc.%20then%20Column%20D%20should%20show%20West%20Cumbria%20and%20if%20it%20contains%20WA1%2C%20WA2%20etc.%20then%20Column%20D%20should%20show%20Warrington%20otherwise%20it%20should%20show%20Other.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20tried%20various%20formats%20for%20the%20IF%20Statement%20but%20cannot%20get%20the%20correct%20values%20to%20return%20-%20I%20have%20tried%20IF%20and%20also%20IF(OR)%20but%20am%20only%20getting%20the%20value%20of%20Other%20to%20return.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20help%20would%20be%20appreciated.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2425287%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2425472%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Formula%20for%20Post%20Code%20Area%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2425472%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1073489%22%20target%3D%22_blank%22%3E%40fion69%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E-%20you%20use%20curvy%20quotes%20in%20formulas%20which%20generates%20and%20%23NAME%3F%20error%2C%20they%20are%20to%20be%20changed%20on%20%22normal%22%20ones%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20214px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F287106i559FAA299F9D10B5%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E-%20formula%20for%20prefix%26nbsp%3B%3DIFERROR(LEFT(B2%2CLEN(B2)-3)%2C%22%22)%20adds%20space%20to%20it%2C%20it%20shall%20be%26nbsp%3B%3DIFERROR(LEFT(B2%2CLEN(B2)-4)%2C%22%22)%20or%20like%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

I hope someone can help.  I have a formula to return the first section of a UK Post Code (column C in the attached file) and using this I want to create an IF Statement to assign the related area (Column D in the attached file). 

 

For example if Column C contains either CA12 , CA13, CA14 etc. then Column D should show West Cumbria and if it contains WA1, WA2 etc. then Column D should show Warrington otherwise it should show Other.  

 

I have tried various formats for the IF Statement but cannot get the correct values to return - I have tried IF and also IF(OR) but am only getting the value of Other to return.

 

Any help would be appreciated.

 

3 Replies
best response confirmed by allyreckerman (Microsoft)
Solution

@fion69 

- you use curvy quotes in formulas which generates and #NAME? error, they are to be changed on "normal" ones

image.png

- formula for prefix =IFERROR(LEFT(B2,LEN(B2)-3),"") adds space to it, it shall be =IFERROR(LEFT(B2,LEN(B2)-4),"") or like

Thanks so much @Sergei Baklan - works perfectly.

@fion69 , glad it helped