+ Reply to Thread
Results 1 to 5 of 5

Multiple IF Statements with Multiple Results

  1. #1
    Registered User
    Join Date
    06-20-2014
    Location
    Yorkshire
    MS-Off Ver
    2013
    Posts
    10

    Multiple IF Statements with Multiple Results

    Hi,

    I'm new here and would like a bit of help please.

    I have a worksheet and in one of my columns I can have multiple values, this could either be a valid numeric value, .e.g "Trace" or a value such as >1.5 or it could be blank.

    Depending on the value I then want to return a different result in another cell.

    In the example I have tried my data is in cell E8

    I have tried the following formula and failed miserably, I'm not sure whether IF or IF OR can cope with this.

    =IF(E8>=0,"1",IF(E8<0,"Invalid",IF(E8="Trace","2",IF(ISBLANK(E8),"4",IF(LEFT(E8,1=">"),"5")))))

    If E8 contains a numeric value equal or greater than 0 then I want it to return a value of 1, this works

    If E8 contains a value that is negative then I want my formula to then display "Invalid"

    If E8 contains the word "Trace" to return a value of 2

    If E8 is blank then to return a value of 4

    If the first character in E8 is ">" then return a value of 5

    Can this be handled in a single formula or do I need to brush up on Macros?

    Any help would be appreciated as this is doing my head in.

    Thanks in advance

  2. #2
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    Re: Multiple IF Statements with Multiple Results

    The problem you encountered was that any input, either alpha or numeric is considered a value. So unless it was a negative number, all text was treated as >= 0. Rewrote the formula to put >= 0 at the end so it has to step through each other IF statement before making it to that one.


    =IF(LEFT(E8,1)=">",5,IF(E8="",4,IF(E8="Trace",2,IF(E8<0,"Invalid",IF(E8>=0,1,"Error")))))
    Janos S. Vamos
    Data Systems Technician/Fire Controlman PO1(SW/AW)
    US Navy Retired


    Remember, Record Macro can be your friend for figuring out solutions.

    Good or Bad, let me know how I did by clicking on the "Add Reputation" * just to the lower left of here. it only takes a few seconds to let someone know.

  3. #3
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: Multiple IF Statements with Multiple Results

    In the order I noticed things:

    1) You've got the syntax wrong on the LEFT expression, you need to move the right paren closing it.

    2) When comparing with a math operator, excel error handing automatically assumes that blank cells assess as zero, and text assesses as greater than zero, so both of those will throw a "1" from the very first conditional.

    This is easy to fix for you: stick a AND in the first conditional to check whether ISNUMBER(E8) as well.

    3) If none of the conditions are met, it's returning FALSE because you left that condition implicit. I will make this code "6" in as a placeholder for whatever you want to return.

    4) You are returning all these codes as text strings, not as numbers. Is that what you want to do? I don't think so because you're saying "value" of the number.

    Result:
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    06-20-2014
    Location
    Yorkshire
    MS-Off Ver
    2013
    Posts
    10

    Re: Multiple IF Statements with Multiple Results

    Thanks to both of you, that makes perfect sense now, I should've twigged really

  5. #5
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    Re: Multiple IF Statements with Multiple Results

    If this has solved the issue, please edit your Original Post and mark the thread as solved. And as always, please provide positive/negative feedback to those who answered the call.

    Thank you and hope your day goes well.

+ 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. Help getting multiple results from multiple criteria on multiple pages
    By ERaasio in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-03-2013, 07:29 PM
  2. Multiple If Statements Causing "FALSE" in Results
    By NYCNYC in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-22-2013, 05:23 PM
  3. [SOLVED] Syntax for formula that uses multiple conditions inside of multiple IF statements
    By njmiller31 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-02-2013, 11:55 AM
  4. [SOLVED] Multiple IF statements & Multiple Results
    By Will_iam in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-18-2012, 06:47 AM
  5. Multiple results from 'if' statements
    By z2xm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-01-2007, 12:26 PM

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