You are here:

# Excel/Alternative to too many nested IF statements

Question
Hi there,

I have a formula that attempts to look at a column and return an "age" value based on a date range. Pretty straightforward, and I know it works.  However, this particular formula exceeds the max number of IF statements for one cell.  I'm looking for an alternative way to write it that fits in one cell, but I'm coming up short.

Here is the formula...

=IF(AND(C3>=DATE(2010,9,1),C3<=DATE(2011,8,31)),5 , IF(AND(C3>=DATE(2009,9,1),C3<=DATE(2010,8,31)),6, IF(AND(C3>=DATE(2008,9,1),C3<=DATE(2009,8,31)),7, IF(AND(C3>=DATE(2007,9,1),C3<=DATE(2008,8,31)),8,IF(AND(C3>=DATE(2006,9,1),C3<=DATE(2007,8,31)),9, IF(AND(C3>=DATE(2005,5,1),C3<=DATE(2006,8,31)),10 , IF(AND(C3>=DATE(2004,5,1),C3<=DATE(2005,4,30)),11 , IF(AND(C3>=DATE(2003,5,1),C3<=DATE(2004,4,30)),12 , IF(AND(C3>=DATE(2002,5,1),C3<=DATE(2003,4,30)),13 , IF(AND(C3>=DATE(2001,5,1),C3<=DATE(2002,4,30)),14 , IF(AND(C3>=DATE(2000,5,1),C3<=DATE(2001,4,30)),15 ,special))))))))))))

Anything you can do to help would be great!

First, this piece:
IF(AND(C3>=DATE(2005,5,1),C3<=DATE(2006,8,31)),10
doesn't seem to be right - I think you want the end to be 2006,4,30

But the real problem is that you need to enter all the info in reverse order in the sheet and have a table like this (which in my example is in range F3:G13):
5/1/2000   15
5/1/2001   14
5/1/2002   13
5/1/2003   12
5/1/2004   11
5/1/2005   10
9/1/2006   9
9/1/2007   8
9/1/2008   7
9/1/2009   6
9/1/2010   5

and use VLOOKUP:
=VLOOKUP(C3,F3:G13,2)
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

#### Bob Umlas

##### Expertise

I`m a Microsoft Excel MVP (Most Valuable Professional) and have been since the inception of the program in 1995. I can answer every kind of Excel question except: API, Importing/exporting to other programs (powerpoint, word,...) Also check out my in-person training link at http://www.thumbtack.com/ny/new-york/excel-training/

##### Experience

Worked with MS Excel since version 0.99 (on the Mac!). Was contributing editor to Excellence Magazine, having written >300 articles. John Walkenbach said of me "I finally met someone who knows as much about Excel as I do."

Publications
Excellence, The Expert, Microsoft

Education/Credentials
BA in math, Hofstra University, 1965

Awards and Honors
MVP
Led sessions for the Convergence 2004-2006 seminar on Excel tips & tricks