Search code examples
excel-formulaexcel-2003vlookupoffice-2003

VLOOKUP to execute a certain formula


I was wondering is it possible to execute formulas with vlookup?
Like:

frequency       date          next date
   day       17/07/2012       18/07/2012       => date +1
  Week       17/07/2012       24/07/2012       => date +7
   Not       17/07/2012           NA           => "NA"

List:

Not     NA
day     1     or date+1
week    7     or date+7
month   31    or date+31
year.   365   or date+365

The purpose is that I'm trying to calculate the next day looking at what the user has used as validation. Working with that list as validation, so the user can't use anything else but those values.
I've tried googling it, but i don't know how to specify the problem exactly...
I hope its clear what I'm after, thanks in advance!


Solution

  • VLOOKUP is the way to go

    assuming you have your list in A1:B5, and store numbers, then your formula would be
    =YourDate+VLOOKUP(Frequency,$A$1:$B$5,2,False)

    the vlookup looks at your list, finds the frequency, and returns the value in the 2nd column in the same line. The False means that it is looking for an exact match