• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 447
  • Last Modified:

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
0
sammenace
Asked:
sammenace
  • 4
  • 2
  • 2
  • +1
1 Solution
 
NBVCCommented:
I would suggest you create a table somewhere in the sheet that lists all the possible 25 combinations and the appropriate rank.

For example, in H2 enter A1, copy down till you see A5, then in next cell B1, copy down, etc.

in I2 down enter the appropriate rank result you want for the combination

Then in D2 you would enter:

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

copied down.
0
 
mark_harris231Commented:
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")
0
 
mark_harris231Commented:
Unless of course, a Grade and Level combined determine the Rank (e.g., what value should a B - 1 have?    How about A - 5?)
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Saqib Husain, SyedEngineerCommented:
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"
0
 
sammenaceAuthor Commented:
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
0
 
sammenaceAuthor Commented:
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.
0
 
mark_harris231Commented:
@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)
0
 
mark_harris231Commented:
@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.
0
 
NBVCCommented:
Again thenassumption is based on the OP saying there were 25 combinations and 5 letters combined with 5 digits makes 25 combinations...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now