+ Reply to Thread
Results 1 to 7 of 7

If then formula not working correctly

Hybrid View

  1. #1
    Registered User
    Join Date
    07-16-2013
    Location
    Brisbane
    MS-Off Ver
    Excel 2013
    Posts
    4

    If then formula not working correctly

    I need to test a cell for a value:

    If the cell is <= 150 then return SR250
    If the cell is 150> but <350 then return SR475
    If the cell is <350 then return 25X3

    I've created a formula but only the 1st two steps are working, if the cell value is 351 it still only returns "SR475" what am I doing wrong?


    =IF(D8<=150,"SR250",IF(350<D8>150,"SR475",IF(350>D8,"25x3")))

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

    Re: If then formula not working correctly

    =IF(D8<=150,"SR250",IF(D8<=350,"SR475","25x3"))


    Using < > doesn't work in formulas because it will test the first assignment of If 350<D8 and return a True or False value, then it will check to see if True/False>150.


    Setting up the formula like I did above, it will check each instance... If it's <= 150 then "SR250" and if that is false, it will check to see if it's <= 350. If it is then it will give you SR475, if not then it will just return "25x3"
    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 Contributor
    Join Date
    11-21-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2007,2013
    Posts
    159

    Re: If then formula not working correctly

    Hi there,

    In addition to above, just in case you need to add another condition you may use below:

    =IF(D8<=150,"SR250",IF(AND(350>=D8,150<D8),"SR475",IF(350<D8,"25x3",IF(...

    Else,

    =IF(D8<=150,"SR250",IF(AND(350>=D8,150<D8),"SR475",IF(350<D8,"25x3")))

    Regards,

    Reimar

    Please click ADD REPUTATION left below this post if this post helped.
    Click * below if this answer helped

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: If then formula not working correctly

    another option...

    =IF(D8<=150,"SR250",IF(AND(D8>=150,D8<=350),"SR475","25x3"))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

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

    Re: If then formula not working correctly

    Out of curiosity, why would you need the additional (D8>=150) inside the AND statement if that parameter is satisfied when (D8<=150) is false?

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: If then formula not working correctly

    OK for a start off, I only needed D8>150, the other test took care of the 150.

    I was just attempting to show how the AND() could be used in this situation, which it looked like, the OP was trying to use

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

    Re: If then formula not working correctly

    Okay, was just wondering if there was some other secret reason that I was unaware of.

+ 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. [SOLVED] Sumifs Formula not working correctly
    By jamaal09 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-01-2013, 09:36 PM
  2. [SOLVED] IF formula not working correctly
    By ErikaC in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-18-2013, 03:38 PM
  3. Replies: 9
    Last Post: 03-08-2013, 11:50 AM
  4. Sumifs formula isn't working correctly
    By gjergji in forum Excel General
    Replies: 5
    Last Post: 09-20-2012, 05:15 PM
  5. Copied formula not working correctly
    By NomadeWolf in forum Excel General
    Replies: 2
    Last Post: 11-05-2010, 05:12 AM

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