I'm trying to extract the first 2 or 3 characters from the lefthand side of a post code (ZIP code) depending upon the length of the post code. If it has 7 characters I want it to return the first 3 characters and if it is less than 7 then only the first 2 characters.

I've ensured that there are no spaces in my post codes.

The post codes are in column B whereas the formula to check the post codes in column B is shown under column C.

The formula is as follows:

=IF(LEN(B2=7),LEFT(B2,3),LEFT(B2,2))

Unfortunately when copied down whatever the length of post code it always shows the first 3 letters. I thought that the 3rd argument being what happens if the length of the post code in column B is not 7 it would show the first 2 characters only?

Help please.

Thanks