Link to home
Start Free TrialLog in
Avatar of sammenace
sammenace

asked on

Excel- Nested IF/AND Function

I am new to excel and I tried to play around with the function but having issues. Hoping someone can help me out

I need to create a spreadsheet which will formulate final ranking  in column D (Rank) based on the information i provided in Column B and C

I have created a Excel- Nested IF/AND Function:

=IF(AND(B2="A",C2="1"), "CRITICAL", "LOW")

There will be 25 combinations for the rank. How can i create a function for all 25? Can anyone please help me out.

**The ranking is determined by the company level and Company Grade**

If the company has a grade of "A,B, C, D" it should be ranked
If the company has "No Grade" the rank by default should be LOW

If Company level is 1 rank is Critical
If Company level is 2 rank is High
If Company level is 3 rank is Medium
If Company level is 4 rank is Low
If Company level is 5 rank is Low

so example:

Company Name       Company Grade            Company Level              Rank
Data INC                          B                                     4                            Low

the excel nested IF/AND function isnt working for me.


Company Name          Company Grade             Company Level        Rank
        XZY                               A                                       1                Critical
        DEF                               B                                       2                 High
        LMN                              C                                    3                  Medium                          
        GHI                               D                                       4                 Low
         JKL                             No Grade                             5                 Low


I have attached the spreadsheet to better understand my question
Test.xlsx
ASKER CERTIFIED SOLUTION
Avatar of NBVC
NBVC
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You really don't need the AND.  You just need to first test if the company has a grade.

=IF(B2<>"No Grade",IF(C2=1,"Critical",IF(C2=2,"High",IF(C2=3,"Medium","Low"))),"Low")
Unless of course, a Grade and Level combined determine the Rank (e.g., what value should a B - 1 have?    How about A - 5?)
You can try a simple formula like

=IF(B2<"E",CHOOSE(C2,"Critical","High","Medium","Low"),"Low")

If you have a fifth level you can add it to the choose function after "Low"
Avatar of sammenace
sammenace

ASKER

Awesome that worked. My only other question would be how can i put the table in sheet2
and map it to sheet1?

Please see attachment
Test.xlsx
mark_harris231

Yes the Grade and the Level combined will determine the Rank. I am new to excel so the first answer i got seems to work. Is that what you would recommend as well?


=VLOOKUP(B2&C2,$H$2:$I$26,2,FALSE)

I am sure the vales will grow and ill have other criteria to add that would determine the final Rank.
@ssaqibh - These returned all ranks as "Critical" when I tested it.  Looks intriguing though.  Wasn't familiar with the CHOOSE function.  I tried B2<>"No Grade" as well, but that gave the same result (?)

@sammenace - I see that you're using the VLOOKUP method.  This really isn't necessary based on an analysis of your table (all Ranks are determined solely on Level).  However, if you do elect to continue down this path, you just add "Sheet2!" in front of the cell reference for the table range:

=VLOOKUP(B2&C2,Sheet2!$H$2:$I$26,2,FALSE)
@ssaqibh - Disregard - forgot I turned off Automatic Calculations earlier - color me embarrassed - your formula works perfectly as laid out.

@sammenace - Yes - if the Rank will be a combination of factors and not just the Level, then the VLOOKUP/table route is the way to go.

Just want to point out that in your sample, the Grade doesn't appear to be a factor in determining the Rank unless it is "No Grade".  Ssaqibh's formula would be more efficient in a single criteria case.
Again thenassumption is based on the OP saying there were 25 combinations and 5 letters combined with 5 digits makes 25 combinations...