Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
Solved

# Excel- Nested IF/AND Function

Posted on 2012-09-12
Medium Priority
441 Views
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

I have attached the spreadsheet to better understand my question
Test.xlsx
0
Question by:sammenace
• 4
• 2
• 2
• +1

LVL 23

Accepted Solution

NBVC earned 2000 total points
ID: 38392818
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

LVL 10

Expert Comment

ID: 38392887
You really don't need the AND.  You just need to first test if the company has a grade.

0

LVL 10

Expert Comment

ID: 38392903
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

LVL 43

Expert Comment

ID: 38392950
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

Author Comment

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

Test.xlsx
0

Author Comment

ID: 38392962
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

LVL 10

Expert Comment

ID: 38392973
@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

LVL 10

Expert Comment

ID: 38392992
@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

LVL 23

Expert Comment

ID: 38393342
Again thenassumption is based on the OP saying there were 25 combinations and 5 letters combined with 5 digits makes 25 combinations...
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are â€¦
Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, youâ€¦
###### Suggested Courses
Course of the Month13 days, 7 hours left to enroll