Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

(80% Discount Ends Soon!)

Nested IF Statements in Excel

I need help nesting an IF function inside another IF function. Say I have four columns. Name(John), Status(FT), Yrs Employed(3), and Vacation Leave(?).
Vacation Leave is based on the status, only FT employees qualify and the number of Years employed.
17 days for full-time employees who have worked more than 5 years.
12 days for FT employees who have worked more than 1 year, 7 days for FT employees who have worked for less than 1 year. 0 for everyone else. Somebody help me please.

I have a formula that returns a value based on the value of another
cell on the same worksheet. For example, cell D1 has a value of
97.00%. The formula is

=if(d1<.93999, 0, if(d1<.94999, .35, if(d1<.95999,.55,

The formula should return a value of .9 in the cell containing the
formula. I am getting the #Value error though and can't figure out
why. If I change the last if statement to read if(d1<=1 then the
formula returns the correct value. The syntax may be off slightly
because Excel is not correcting me but I think you have the idea. Any

am i able to use more than 7 if conditions in one input? if not, is there another way i can do it THAT IS SIMPLE? What's the simpliest way I can do if conditions that's passed 7?

Good day,
I have filled the following formula in many cells of a spreadsheet.

=IF(ISERROR(VLOOKUP(D75,'Sheet1'!$D$3:$D$5442,1,FALSE)),0,IF(ISERROR(VLOOKUP(C75,'Sheet1'!$C$3:$C$54 42,1,FALSE)),0,IF(ISERROR(VLOOKUP(C75&" - "&D75,'Sheet1'!$A$3:$I$5442,9,FALSE)),VLOOKUP(C75&" - "&G75,'Sheet1'!$B$3:$I$5442,9,FALSE),VLOOKUP(C75&" - "&D75,'Sheet1'!$A$3:$I$5442,9,FALSE))))

I am wondering if I have nested too many functions for this to work properly. In the case where one of the first two if statements are true (an error would be produced), I am receiving a "0" as specified. However, in the case where the statement VLOOKUP(C75&" - "&D75,'Sheet1'!$A$3:$I$5442,9,FALSE) results in an error then I should have the return of VLOOKUP(C75&" - "&G75,'Sheet1'!$B$3:$I$5442,9,FALSE), but am getting a #REF! error instead.

Any thoughts?

Thank you in advance,

Hi guys, hopefully you can shed some light onto this small problem I am having.

The current formula I'm trying to use is:


This isn't producing the desired results.

What I am trying to do in words is this:

IF... in this array it equals A4 then look at coloum 6 and then Countif col 6 says Pass and then add another if it says Fail

I think I've gotten the syntax mixed up...can anyone guide me?

I've searched through about 4 pages of threads with "time" in the title but cannot find an example of this situation.

I am trying to build an if statement to test variables that are in time format and then perform a calculation.

I was able to get an example working if I convert the start times to integers rather than time values. However, the data won't be provided to me as integers.

So, I need a nested if statement (using "and") that will test for two situations using cells in time format or I need to write a macro to convert the time data to integer format. I've been working on the former most of the day and have hit a brick wall.

Can someone take a look at this and offer a solution or perhaps something I haven't considered.



Just wondering how man nested IF functions excel 2010 can handle in one cell.


Hey all,

I am new to excel and this forum, so sorry for the clumsiness.

So, I am trying to use Vlookup to 'grab' a date from one sheet and place it in another. It is important that if the value cannot be found then the cell is left blank (no #N/A).

I built the following and it works well:


Next, I want the Vlookup to deal with three IF functions. So, if the first cell is blank it checks the previous, and if that cell is blank then it checks the previous and finally if that cell is blank does not return any value (including #N/A).

I tried this:

=IF(ISBLANK(VLOOKUP(B17,Sheet1!A32:M94,13,FALSE)),IF(ISBLANK(VLOOKUP(B17,Sheet1!A32:M94,12,FALSE)),I F(ISERROR(VLOOKUP(B17,Sheet1!A32:M94,11,FALSE)),"",VLOOKUP(B17,Sheet1!A32:M94,11,FALSE)),VLOOKUP(B17 ,Sheet1!A32:M94,12,FALSE)),VLOOKUP(B17,Sheet1!A32:M94,13,FALSE))

This does everything all the way to if the last cell is blank it places #N/A instead of leaving the target cell blank.

I have attached my sheets, if that helps.

Any thoughts?

If I need to clarify my question just let me know.


Is there a way to shorten the following statements?



I need to add both to a much longer formula but then I exceed the maximum number of nested statments.



I am trying to create a validation for a column based off of the previous
columns value, which reqires many nested if functions, (10 to be exact).
However the limit of 7 nested if function prevents me from being able to do
this. With all the amazing things that excel can do, there has to be some
sort of work-around for this.

Any ideas?

Hey all,
I am using a combination of nested IF statements and VLOOKUPs to get a vlue to appear in a specific cell.

The IF statements check to see if a specific text value displays in a specified cell and then uses a VLOOKUP to match the value to that text if true. If it is false it moves on to check the next specific text value. There are 5 different text values it needs to check.

I have gotten my formula to the point where it can match all the text values appropriately with the VLOOKUPs, however I can't seem to close out the formula should NONE of the text value's be true. When this happens the cell returns a value of "FALSE". I would like to be able to avoid this and have a number value displayed.

Hi Folks..

Would appreciate a bit of assistance on a nested if statement. My boss has asked if it is possible to format a cell based on the contents of another cell.

What he means is, if we have the following grouping:

83-99 'Underachieving'
100-110 'Average'
111-126 'Above Average'

and say cell A1 has the value 92, cell B2 would say 'Underachieving'. Similarily, if cell A1 had the value 120, Cell B2 would say 'Above Average'
How do I format the nested if statement in Cell B2 to display the relevant value.

Assistance greatly appreciated.


Consider the provided spreadsheet. I had to calculate the range of data on 30 days intervals and had to use multiple nested if statements to write the function.

All though it works fine, i was wondering if there was an easier alternative to this method.

Kindly help.


Excel experts and friends.I cannot find any posts to help with my problem. I export a spreadsheet on a monthly basis and copy to excel in various tabs. January numbers are sheet 1, Feb numbers are sheet 2, March, sheet 3 etc. There is a master file I use to derive metrics from the sheets. I am trying to create an IF Statement in a cell in the master file that says to show the latest information in the target cell, in this case sheet 12 (dec). If the cell is empty, next look a the same cell in sheet 11(nov), if Nov is blank as well then look in sheet 10 (Oct) etc all the way until Jan if all of those are empty or 0. Here is what I have managed to create for the Decmeber cell

=IF('Dec Calculations'!Q149=0,IF('Nov Calculations'!Q149=0,IF('Oct Calculations'!Q149=0,IF('Sep Calculations'!Q149=0,IF('Aug Calculations'!Q149=0,IF('Jul Calculations'!Q149=0,IF('Jun Calculations'!Q149=0,IF('May Calculations'!Q149=0,IF('Apr Calculations'!Q149=0,IF('Mar Calculations'!Q149=0,IF('Feb Calculations'!Q149=0,'Jan Calculations'!Q149)))))))))))

but it gives me an answer of "false".

Answering this question is my only wish this holiday season. I am willing to use any Excel Command, I am running Excel 2007. Windows Vista.

I want to do a formula in G2 that states if E2 is between 2 dates then add E2 +85 and if it isn't between those two dates check if F2 is between same 2 dates. if F2 is then add F2 +85. if not, then leave G2 blank.

On top of that i want it to go to the next worksheet if it is the end of 2010 (i.e., put the same things in the 2011 worksheet so it carries on)

I have an assignment in which I have to use nested, IF, AND and OR functions. Does anyone know the syntax for this kind of function? Basically I have to determine leave time based on years of service and whether the employee is full time or part time. Part-time with less than 1.5 years of service = 0 days of leave Part-time over 1.5 and full-time under 1year = 3 days of leave and full time over 1 year = 5 days of leave. I know how to do a nested function, but I have not worked with both an AND and OR together.

Thanks in advance!!!

Thanks Agoin


I have a condition where I want to create a nested IF statement that takes into account multiple OR conditions with data in various adjacent and non-adjacent cells. I need something like the literal statement below, that can be easily appended, if I decided to add other cells/criteria.

=IF (C8 ) contains "INF-" OR IF (C8) contains "Main" or IF (F9) equals "(blank)" OR IF (F9) = "XXXXXX", "Don't Count", "Count")

thanks in advance for any solutions/advice...!

What I need to do is to COUNTA and COUNTIF on specific columns only on rows where a different column contains specific information, I'll try a visual below...

1 0 1
1 1 1
1 0 0
1 1 1
2 1 0
2 1 0

I need the function to check column a, if a=2, then I want it to countif columns b and c separately (functions will be separate for each column).

Here's a sample of what I'm trying to use:



But it's giving me an error with the "I141E" section. This is an ID I'm checking to try and separate data without doing it manually.

I realized I can do the COUNTA function I need by simply utilizing the original "A" column, but I'm still stumped on how to COUNTIF on columns "b" and "c" only on row which contain specific data "2" in column "A"...

I have a cell with 7 nested if's in it. I want the cell to be blank is the cell previous to it is blank.

This is my formula (without spaces):

= IF (R40 < $D$20-2,$B$19, IF (R40 < $D$21-2,$B$20, IF (R40 < $D$22-2,$B$21, IF (R40 < $D$23-2,$B$22, IF (R40 < $D$24-2,$B$23, IF (R40 < $D$25-2,$B$24, IF (R40 < $D$2-2,$B$25, IF (R40 < $D$3-2,$B$2))))))))

I know how to do it with one IF formula, using "" at the end, but doesn't seem to work with this forumla?!?


Does nested OR() work?

I need some help with a formula for conditional formatting which should satisfy three conditions. The hitch is two of those conditions should be clubbed as Condition 1 and the third should stand as Conditon 2. It goes something like this:

If [Today

Here is my problem:
Excel spreadsheet will contain a form that will consist of drop down boxes (data validation). Each drop down box will define the data that can be selected in the next drop down box.

The way I initially went about it, is creating nested IF statements. However, we all know there is a limit of 7 nested IF statements. I have 10! So below formula does not work:
=if(B5=1,F5:I5, if(B5=2, F6:I6, if(B5=3, F7:H7, if(B5=4, F8:J8, if(B5=5, F9:H9, if(B5=6,F10:G10, if(B5=7,F11:H11, if(B5=8,F12:H12, if(B5=9, F13:I13, if(B5=10, F14:K14))))))))))

I tried other workarounds such as CONCATENATE, or & signs. No luck. VLOOKUP does not work also, because there are multiple columns in col_index_num. Anything else I try gives me this message:
“The List Source must be a delimited list, or a reference to a single row or column”

What should really happen is this:
User selects value in first list box. Second list box shows values associated wih the value from the first drop down only.

Hi guys,

This is my first post and i'm not particularly advanced at Excel so apologies if this is a stupid question.

I'm using nested IF functions to reduce a large number of bands to a smaller set using the following formula:



I am trying to make a rollout schedule, whish is a plan for how many of X items to build pr Week. I have a list of milestones and their lead times. Like this:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z AA AB AC 3 Week 4 Lead time 51 52 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 5 Milestone 1 1 0 1 1 1 2 2 3 5 6 6 9 9 0 0 0 0 0 0 0 0 0 6 Milestone 2 1 0 0 1 1 1 2 2 3 5 6 6 9 9 0 0 0 0 0 0 0 0 7 ref MS Milestone 3 2 1 1 1 2 2 3 5 6 6 9 9 8 Milestone 4 3 0 0 0 1 1 1 2 2 3 5 6 6 9 9 0 0 0 9 Milestone 5 2 0 0 0 0 0 1 1 1 2 2 3 5 6 6 9 9 0

I have defined the curve of the rollout graph in the ref. Milestone. I then use nested IF to get this schedule. In cell L8:
This only works for up to 7 weeks of leadtime, which is the max number of nested IF. How can I use OFFSET to to the same?

Hi Everyone

I have the following formula and would like to add to it but I'm not sure where to create the additional argument:


Where the ISNA is false, it currently returns a zero value regardless that the cell it's copying from is blank - I would like this to show as "-" rather than a zero. I'm sure this must be possible, as I've used ISBLANK previously, I just don't know where to insert it into my formula.

Thanks in advance for any help.