+ Reply to Thread
Results 1 to 3 of 3

LEN and Nested IF Function

  1. #1
    Registered User
    Join Date
    01-28-2020
    Location
    Epsom
    MS-Off Ver
    Version 16.33, Excel
    Posts
    0

    Red face LEN and Nested IF Function

    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

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166
    Hello Scoffers,

    Welcome to Excelforum. Be a part of large Excel community. Enjoy Learning.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,546

    Re: LEN and Nested IF Function

    Hello Scoffers and Welcome to Excel Forum.
    You have posted a question in a section that is used for introductions. Please copy your post and repost in the Excel Formulas & Functions forum.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 01-05-2019, 03:33 AM
  2. [SOLVED] Nested vlookup or nested IFAND function?
    By jeptik in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-11-2017, 02:27 AM
  3. Calling function inside function. (aka nested function)
    By jakopak in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2015, 05:58 AM
  4. COUNTIF/COUNTIFS function + nested user-defined function
    By shamjamali in forum Excel General
    Replies: 1
    Last Post: 05-12-2015, 09:12 PM
  5. [SOLVED] Nested Function With Division - Receiving #VALUE! Function Error
    By DDM64 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-17-2013, 01:16 PM
  6. [SOLVED] Nested AND function within IF function is only addressing logical1 but not logical2
    By betic in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-20-2012, 09:17 AM
  7. [SOLVED] Offset function with nested match function not finding host ss.
    By MKunert in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-21-2006, 06:50 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1