Forum Discussion

rt2963's avatar
rt2963
Copper Contributor
Feb 14, 2025

Problem with LOOKUP function.

I have a workbook which keeps track of money in an account. I use the LOOKUP function to lookup the most recent date in one column and return the corresponding value in another column thereby telling me the current sum in the account. So far, so simple. However, I have discovered that if the sum in the second column is larger than the date in decimal in the first column, it will return the second largest sum.

See the attachment for the relevant data. For reference, 45702 is the decimal for 14th February 2025.

If I use the function =LOOKUP(MAX(A2:A50), C2:C50)  I would expect £47,447.29 to be returned. However, it returns £45,658.85. I adjusted the figures to find out what the largest sum was that the function would return and in this case it happens to be £45,702 which happens to be the decimal format for 14th February 2025. If I increase the date, the maximum returnable sum increases accordingly but can never be greater than the date in decimal.

Is there a valid reason for this? Am I making a schoolboy error of which I'm unaware or is there another reason? 

Thanks in advance.        

  • Your formula tries to find the numeric representation of the max date in column C. Instead, find the location of the max date in column A, then return the corresponding value in column C:

    =XLOOKUP(MAX(A2:A50), A2:A50, C2:C50)

    or

    =VLOOKUP(MAX(A2:A50), A2:C50, 3, FALSE)

  • To lookup max value in column A and return related value from column C

    =LOOKUP(MAX(A2:A50), A2:A50, C2:C50 )

Resources