Forum Discussion

JohnG1948's avatar
JohnG1948
Copper Contributor
Sep 09, 2023

Retuning the value of a cell based on another cell found to have a given value

Hi Everyone 

This is my 1st post so forgive me if I'm not perfectly clear. I spent many years programming in many languages from assembler to C++ but this my 1st foray into Excel. It's turning out to be a bit of a culture shock.

I have a sheet with dates in column "A" and values in Column "C". I want to search column "A" for a date that is "<=" a given date (that part seems easy enough). Now I want to return the value in the corresponding row in column "c".

Phrased differently: if a date <= given date found A10 return value in C10.

Thanks in advance

John

  • JohnG1948 

    Will the dates in column A be sorted in ascending order?

    Do you want to return the value of the first date <= given date that is found in column A, going from top to bottom,or the last date <= given date, or ...?

    • JohnG1948's avatar
      JohnG1948
      Copper Contributor
      The dates will be in ascending order.
      I do not want to return the date. I want to return the value in another column "A" has dates "C" has values I need
      • HansVogelaar's avatar
        HansVogelaar
        MVP

        JohnG1948

        Yes, I understood that, but you didn't answer my question.

        Does this do what you want?

        The formula in G2 is

        =XLOOKUP(F2,A2:A10,C2:C10,"",-1)

Resources