Lookup using dates [SOLVED]

  • Hi!


    I would like to lookup a value from a database like this.
    Date Sum
    2002-04-24 53500
    ......


    I want to base this lookup on a date and then lookup the value from one year ago.
    Sofar I have come up with
    =lookup(DATE(YEAR(A1)-1,MONTH(A1),DAY(A1)),Fsg,2)
    Where Fsg is the name of the database and 2 the column index. But it doesnt work dont know why.....


    Anyone got a hint? TIA Mats:flower:

  • Hi Mats,


    According to the help your syntax is wrong. No need for the 2,


    Lifted straight from the help file;

    Quote

    Syntax for Array form of Lookup


    LOOKUP(lookup_value,array)


    Tip :eureka:
    In general, it's best to use the HLOOKUP or VLOOKUP function instead of the array form of LOOKUP. This form of LOOKUP is provided for compatibility with other spreadsheet programs.


    So try,
    =VLOOKUP(DATE(YEAR(A1)-1,MONTH(A1),DAY(A1)),Fsg,2,FALSE)


    Cheers
    Andy

    [h4]Cheers
    Andy
    [/h4]

Participate now!

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