+ Reply to Thread
Results 1 to 3 of 3

confusion using LEFT in an IF statement

  1. #1
    Registered User
    Join Date
    02-05-2014
    Location
    UK
    MS-Off Ver
    Excel 2013
    Posts
    2

    confusion using LEFT in an IF statement

    ok, I have an If statement which needs to look at a cell, identify the leading number and depending on the condition perform 1 INDEX MATCH or another.

    Basically the data spans 2 sheets.

    The reference it is looking at is in the format 0001/17, 0002/17

    So I have set the If to use LEFT(B2) which correctly returns a 0 in this case. the problem I have is that the If statement is seeing that as > 4 and unless my maths are really off that's not right.

    I can write the formula with the condition backwards but my need to understand the issue is more important, any ideas?

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: confusion using LEFT in an IF statement

    The LEFT function returns a TEXT value even if it looks like a number.

    "0" = a text value

    In Excel TEXT values are greater than numeric values.

    ="0">4 = TRUE

    "0" and 0 are not the same!

    So, you need to convert the TEXT value "0" to the numeric value 0.

    One way to do that...

    =--LEFT(B2)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Valued Forum Contributor Melvinrobb's Avatar
    Join Date
    06-19-2012
    Location
    Manitoba, Canada
    MS-Off Ver
    Excel 2013
    Posts
    1,128

    Re: confusion using LEFT in an IF statement

    The cell interprets the field as a text value, so the character your left function is pulling is a text value as well.

    instead of left(b2) try (left(b2)+0)

    this converts the text value to a number value.
    Please click the * icon below if I have helped.

+ 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. IF(LEFT Statement
    By DLG415 in forum Excel General
    Replies: 9
    Last Post: 04-09-2016, 04:02 PM
  2. If left statement not working
    By snsman in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-22-2015, 07:46 AM
  3. [SOLVED] Holy Moley, IF AND INDEX MATCH LEFT confusion
    By bentod in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 06-16-2014, 05:37 PM
  4. For Each Statement confusion!
    By joshisms in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 08-31-2013, 02:40 AM
  5. [SOLVED] confusion with IF statement
    By Mortada in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-15-2012, 05:48 PM
  6. IF Statement Confusion
    By penny in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-13-2007, 03:38 PM
  7. If statement confusion
    By DianeR in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-20-2007, 07:48 AM

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