You are here:

Excel/Vlookup for Multiple Columns

Advertisement


Question
Would you kindly assist me with formula that will look at the date in column 12, if there is no date, look at column 13, if there is no date, look at column 14 and if there is no date return "-" (if I do not put a place holder it returns a date of Jan 0, 1900).  This is what I currently have.

=IF(VLOOKUP(Subject1,TABLEA,12,FALSE),VLOOKUP(Subject1,TABLEA,13,FALSE),VLOOKUP(Subject1,TABLEA,14,FALSE),"-)

When tested, column 12 is blank but instead of looking at column 13 it is going to column 14 first.

Answer
The formula will have to be a bit more complicated, with nested ifs; something like:
=IF(VLOOKUP(Subject1,TABLEA,12,FALSE)<>"", VLOOKUP(Subject1,TABLEA,12,FALSE),IF(VLOOKUP(Subject1,TABLEA,13,FALSE)<>"",VLOOKUP(Subject1,TABLEA,13,FALSE),IF(VLOOKUP(Subject1,TABLEA,14,FALSE)<>"",VLOOKUP(Subject1,TABLEA,14,FALSE),"-")))
I have assumed that the condition to move along the columns is that the cell is not blank (<>""), but you can change it if needed.

Hope this helps,
Miguel
About Excel
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

All Answers


Answers by Expert:


Ask Experts

Volunteer


Miguel Zapico

Expertise

I will try to answer any question that I can replicate in my current environment (I use Excel 2003 with Windows XP). This may include formula related questions on other Excel versions. Due to time limitations, I am not writing custom code to answer questions any more. Sorry for the inconvenience.

Experience

I have worked with Excel for the past 12 years, in various environments.

Organizations
NYPC (New York PC users group)

Organizations
NYPC (New York PC users group)

Education/Credentials
MCSE in Windows NT

©2010 About.com, a part of The New York Times Company. All rights reserved.