Can I Prioritize or Wieght an IF Statement?

jjbNana

New Member
Joined
Jul 21, 2011
Messages
19
Hi, all,

I have a large spreadsheet, with 2000+ rows/records. I categorized each record with a value of L, M, or H. At the top of the sheet (cell AM4), I want to report if an "H", an "M" or an "L" has been entered in the categorization column, in that order. In other words, I want to weigh-out or boil-up the category, so an "H" would outweigh an "M" or "L" and so on. The formula I have thought of (but obviously does not work) is:

=IF(AM5:AM2933="H","H")*IF(AM5:AM2933="M","M")*IF(AM5:AM2933="L","L")

I thought that if I strung the IF statements together, then each would report it's TRUE result (if found), or look to the next IF statement if the value was FALSE. Clearly, my logic was not sound.:confused:

Thank you in advance for anyone who may be able to help.
 
Last edited:

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Welcome to the board...

If I understand right...

Try
=LOOKUP(2,1/ISNUMBER(MATCH({"L","M","H"},AM5:AM2933,0)),{"L","M","H"})
 
Upvote 0
and return what value exactly?

The value would be an H, an M or an L. I would then conditionally format the cell to fill red for H, yellow for M and green for L, so as to see the overall categorization at a glance of the sheet.
 
Upvote 0
Thanks.

The result "#N/A" came back, like it didn't find an L, M or H in any of those cells.

Which version of XL do you have?

XL2007 or Higher, try

=IFERROR(LOOKUP(2,1/ISNUMBER(MATCH({"L","M","H"},AM5:AM2933,0)),{"L","M","H"}),"")


Pre 2007, it will be a tad longer..

=IF(ISNA(LOOKUP(2,1/ISNUMBER(MATCH({"L","M","H"},AM5:AM2933,0)),{"L","M","H"})),"",LOOKUP(2,1/ISNUMBER(MATCH({"L","M","H"},AM5:AM2933,0)),{"L","M","H"}))
 
Upvote 0
Which version of XL do you have?

XL2007 or Higher, try

=IFERROR(LOOKUP(2,1/ISNUMBER(MATCH({"L","M","H"},AM5:AM2933,0)),{"L","M","H"}),"")

I have 2007, and your 1st suggestion worked like a charm. I initially pasted it into the wrong version of the spreadsheet. I have two with variable columns, and I put it in the one where "AX" was the right column. So, I fixed the column reference, and it worked. Thank you.

You're the best!
 
Upvote 0
Glad to help, thanks for the feedback..

If you also have 2003, you might be well served to use the version compatible with both versions...

Here's another way to do it that is a bit shorter (works in either version of XL)

=LOOKUP("Z",CHOOSE({1,2},"",LOOKUP(2,1/ISNUMBER(MATCH({"L","M","H"},AM5:AM2933,0)),{"L","M","H"})))
 
Upvote 0
Glad to help, thanks for the feedback..

If you also have 2003, you might be well served to use the version compatible with both versions...

Here's another way to do it that is a bit shorter (works in either version of XL)

=LOOKUP("Z",CHOOSE({1,2},"",LOOKUP(2,1/ISNUMBER(MATCH({"L","M","H"},AM5:AM2933,0)),{"L","M","H"})))

It even picked up the conditional formatting I already had on the entries on each row.

Thanks again!
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,850
Members
452,948
Latest member
UsmanAli786

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