Nested IF function returning "true" when applying logic intended for numerals to text - how to fix?

KateDu

New Member
Joined
Jul 17, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi guys,

I've got a series of values in six columns that I want my spreadsheet to look at and tell me which template I need to use - insufficient, normal or at risk.

If all values are "X", then it should (and does) return "insufficient".
If all values are outside my logic tests (i.e. <1 or >15 for the first column etc), it should return "normal".
If any of the values are within my logic tests, i.e. true, then it should return "at risk" (in the above case - the first column should return "normal" if the value falls between 1-15 but "at risk" if <1 or 16+).

The problem arises when one of the columns has an "X" rather than a value. In those cases, I need my formula to essentially return a false and continue evaluating the subsequent columns with the relevant logic tests. However, the formula is evaluating an "X" (or any other text/symbol value I put in there) as true and returning "at risk".

The formula I have is:

=IF((COUNTIF(F11,"X")=1)*AND(COUNTIF(I11:M11,"X")=5),"Insufficient",(IF(F11<1,"At risk",(IF(F11>15,"At risk",(IF(I11>149,"At risk",(IF(J11>199,"At risk",(IF(K11<40,"At risk",(IF(L11>129,"At risk",(IF(M11>29,"At risk","Normal")))))))))))))))

(Note, columns G and H are not considered in the formula as they do not influence the outcome, so they have been purposefully omitted)

I've tried doing this multiple ways and I just don't seem to be able to work it out. Please help?

DBS excel image.JPG
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
I a might be completely off track but can you try this in S10
Excel Formula:
=IF((COUNTIF(F10,"X")=1)*(COUNTIF(I10:M10,"X")=5),
          "Insufficient",
           IF(OR(
                      (F10<1)*N(F10),
                      (F10>15)*N(F10),
                      (I10>149)*N(I10),
                      (J10>199)*N(J10),
                      (K10<40)*N(K10),
                      (L10>129)*N(L10),
                      (M10>29)*N(M10)),
                              "At risk",
                              "Normal"))
 
Upvote 0
I a might be completely off track but can you try this in S10
Excel Formula:
=IF((COUNTIF(F10,"X")=1)*(COUNTIF(I10:M10,"X")=5),
          "Insufficient",
           IF(OR(
                      (F10<1)*N(F10),
                      (F10>15)*N(F10),
                      (I10>149)*N(I10),
                      (J10>199)*N(J10),
                      (K10<40)*N(K10),
                      (L10>129)*N(L10),
                      (M10>29)*N(M10)),
                              "At risk",
                              "Normal"))
That works! Thank you so much Alex!
 
Upvote 0
Thanks for letting me know. Glad I could help.
FYI: N returns a 0 if the cell is text or blank.
 
Upvote 0
Thanks for letting me know. Glad I could help.
FYI: N returns a 0 if the cell is text or blank.
So I saw after you alerted me to it. Very handy to know! This is perfect, except where a value in the cell is actually 0, but I can eyeball those - there's only be one in 190 sets of results thus far.
 
Upvote 0
Having to eyenball it is not the best idea. Try this:
(I have only changed the ones where the value 0 matters)

Excel Formula:
=IF((COUNTIF(F10,"X")=1)*(COUNTIF(I10:M10,"X")=5),
          "Insufficient",
           IF(OR(
                      (F10<1)*ISNUMBER(F10),
                      (F10>15)*N(F10),
                      (I10>149)*N(I10),
                      (J10>199)*N(J10),
                      (K10<40)*ISNUMBER(K10),
                      (L10>129)*N(L10),
                      (M10>29)*N(M10)),
                              "At risk",
                              "Normal"))
 
Upvote 0
Solution
Having to eyenball it is not the best idea. Try this:
(I have only changed the ones where the value 0 matters)

Excel Formula:
=IF((COUNTIF(F10,"X")=1)*(COUNTIF(I10:M10,"X")=5),
          "Insufficient",
           IF(OR(
                      (F10<1)*ISNUMBER(F10),
                      (F10>15)*N(F10),
                      (I10>149)*N(I10),
                      (J10>199)*N(J10),
                      (K10<40)*ISNUMBER(K10),
                      (L10>129)*N(L10),
                      (M10>29)*N(M10)),
                              "At risk",
                              "Normal"))
That's perfect - thanks Alex!!
 
Upvote 0

Forum statistics

Threads
1,214,879
Messages
6,122,065
Members
449,064
Latest member
scottdog129

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top