vlookup based on date

  • I am looking up a date in a cell in a table, then the number of cells I go over in the table is determined by if the date is before march 1st 2005 or after. It simply won't return the correct value. Here is the formula I'm using: =IF($A8<$T$7,VLOOKUP(E8,all,2,VLOOKUP(E8,all,3))) variables are: A8 (date), T7 (3/1/2005), E8 (number of years calculated by today's date - date in A8), all (table with year, hrs if before, hrs if after)

  • The syntax of VLOOKUP is


    VLOOKUP(Lookup_Value,Table_Array,Col_Index_Number,[range_lookup])


    you Col_Index_Number is fixed at 2, please check.


    or maybe you really are wanting?


    =IF($A8<$T$7,VLOOKUP(E8,all,2,False),VLOOKUP(E8,all,3,False))


    or


    =VLOOKUP(E8,all,IF($A8<$T$7,2,3),False)

    Where there is a will there are many ways. Finding one that works for you is the challenge!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!