+ Reply to Thread
Results 1 to 8 of 8

IF AND Functions coming back as False

  1. #1
    Registered User
    Join Date
    07-14-2015
    Location
    Canada
    MS-Off Ver
    MS365 Version 2209
    Posts
    49

    IF AND Functions coming back as False

    =IF(AND($K$4>=1,$K$4<=4),"+2",IF(AND($K$4>="5",$K$4<="8"),"+3",IF(AND($K$4>="9",$K$4<="12"),"+4",IF(AND($K$4>=13,$K$4<=16),"+5",IF(AND($K$4>="Lvl 17",$K$4<="Lvl 20"),"+6")))))

    I have that function, It was showing FALSE but when I put the "" around the numbers it worked except IF(AND($K$4>="9",$K$4<="12") Can anyone explain why this one portion is showing false? Is it because it goes from single digit to double? If so, how do I fix that?

  2. #2
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: IF AND Functions coming back as False

    You are using quotation marks for numbers - this tells Excel to treat it as texts. As such, "9" and "12" has different sizes than the numeric 9 and 12. That is "12" is actually less than "9". I would recommend working with actual numeric figures instead, as you've down for numbers between 1 and 4. Removing all quotation marks around the numbers should resolve the issue.

    Additionally, you are comparing "Lvl 17" and "Lvl 20" - this is inconsistent with the other comparison type where you only look at the numbers and do not include the text Lvl. Potential error here.

    Also, the final IF function you have (Lvl 17 and Lvl 20) does not have a value_if_false component, and will result in FALSE if the number in K4 does not meet any of the requirements.

    Lastly, looking at your formula, it seems like it can be simplified to a LOOKUP, i.e.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-14-2015
    Location
    Canada
    MS-Off Ver
    MS365 Version 2209
    Posts
    49

    Re: IF AND Functions coming back as False

    =IF(AND($K$4>=1,$K$4<=4),"+2",IF(AND($K$4>=5,$K$4<=8),"+3",IF(AND($K$4>=9,$K$4<=12),"+4",IF(AND($K$4>=13,$K$4<=16),"+5",IF(AND($K$4>=17,$K$4<=20),"+6","")))))

    This is without quotations, however it now responds as a blank cell due to my "" for false, for some reason it is not seeing the numbers in the CELL, the CELL that is reference has a long IF AND function in it as well which is to calculate base on another cells input, unsure if this is a problem which I assume not.

    As for your suggestion of the lookup function, yours returns N/A and I am not familiar enough in it to trouble shoot that. However it looks as though in the LOOKUP you are looking at a list of cells and it searches those cells for your query, well I need it checking the one cell and anything equal to and between 1-5 is to have 2 which as said would work with quotations around the numbers but won't work without quotations.

  4. #4
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: IF AND Functions coming back as False

    The #N/A error you have in your LOOKUP tells me that the cell in K4 is recognised as a text. Are you able to change the formula in K4 to be as below and see if it works.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The LOOKUP function works this way
    =LOOKUP(K4, RangeToFind, ResultingRange)

    What it does is, look at K4, whatever number it maybe, and try and find it within RangeToFind. Once it finds a number (or the smaller closer number), it returns the corresponding number in ResultingRange.

  5. #5
    Registered User
    Join Date
    07-14-2015
    Location
    Canada
    MS-Off Ver
    MS365 Version 2209
    Posts
    49

    Re: IF AND Functions coming back as False

    =IF(AND($H$4>=0,$H$4<=299),"1",IF(AND($H$4>=300,$H$4<=899),"2",IF(AND($H$4>=900,$H$4<=2699),"3",IF(AND($H$4>=2700,$H$4<=6499),"4",IF(AND($H$4>=6500,$H$4<=13999),"5",IF(AND($H$4>=14000,$H$4<=22999),"6",IF(AND($H$4>=23000,$H$4<=33999),"7",IF(AND($H$4>=34000,$H$4<=47999),"8",IF(AND($H$4>=48000,$H$4<=63999),"9",IF(AND($H$4>=64000,$H$4<=84999),"10",IF(AND($H$4>=85000,$H$4<=99999),"11",IF(AND($H$4>=100000,$H$4<=119999),"12",IF(AND($H$4>=120000,$H$4<=139999),"13",IF(AND($H$4>=140000,$H$4<=164999),"14",IF(AND($H$4>=165000,$H$4<=194999),"15",IF(AND($H$4>=195000,$H$4<=224999),"16",IF(AND($H$4>=225000,$H$4<=264999),"17",IF(AND($H$4>=265000,$H$4<=304999),"18",IF(AND($H$4>=305000,$H$4<=354999),"19",IF(AND($H$4>=355000),"20"))))))))))))))))))))

    This is my K4 cell..... I may have to try changing it in the morning.

  6. #6
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: IF AND Functions coming back as False

    Right, remove the quotation marks within "1", "2", "3", etc. That should fix it.

    Also, looks like you can apply the same LOOKUP function here.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    OR even shorter,
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-14-2015
    Location
    Canada
    MS-Off Ver
    MS365 Version 2209
    Posts
    49

    Re: IF AND Functions coming back as False

    Thanks for the help, it's working perfectly. I'm no advanced user in excel and admit it, I'll have to play with Lookup more often I guess lol

  8. #8
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: IF AND Functions coming back as False

    Excellent. The LOOKUP will make your formula a lot shorter.

    If your initial query is resolved, please mark your thread as Solved by clicking on Thread Tools above your initial post and click on Mark This Thread as Solved.

+ 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: 1
    Last Post: 11-08-2013, 10:37 PM
  2. VLOOKUP Formula coming back with NA#
    By monza2 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 10-18-2012, 01:38 AM
  3. Macro coming back with Run Time Error
    By amasulli in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-14-2012, 10:44 AM
  4. Search or Find to False in a row/back to back
    By zit1343 in forum Excel General
    Replies: 2
    Last Post: 04-20-2012, 04:35 PM
  5. Web Query Coming Back Blank In Excel 2010
    By adam1230 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-28-2011, 03:56 AM
  6. Replies: 4
    Last Post: 06-08-2011, 03:06 AM
  7. [SOLVED] emailed docs coming back in different format
    By JL Adamson in forum Excel General
    Replies: 0
    Last Post: 10-05-2005, 12:05 PM
  8. Replies: 1
    Last Post: 06-03-2005, 02:05 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