简体   繁体   中英

How can I select a specific cell value filtering with the nearest date (in a column) to select a specific row?

I am very new in Excel and I have to implement this pretty complex task (at least for me it is complex).

I put what I am doing here: https://drive.google.com/open?id=1sWHbyl-Y-GgSiX7JJ3bJ9_y8DUts-E0e

I will try to explain exactly what I have to do:

For each rows I have to "calculate" the value of the L column in this way.

Each cell into the L column is "calculated" using the following steps:

  • Considers the date into the H column of this row.
  • Search the nearest date in the past into the A column to select a specific row.
  • Take the E column value of this row and use it to populate the current L cell.

So doing a practical example, I want to populate the L3 cell, I have to do:

  • Considers the date into the H column of this row: so I obtain the value of the H3 row that is this date: 16/12/2017 .

  • Then, into the whole A column I search the nearest date in the past in this column (in this case it is 15/12/2017 ), so I select the row number 4 .

  • Take the value of E4 cell value ( 598,05 € ) and write it into my L3 cell.

How can I do something like this?

Thank you

This is a simple INDEX(...,MATCH()) situation.

=INDEX(E:E,MATCH(H3,A:A,1))

This will return the value in column E such that the date in column A is the greatest date less than or equal to the value in H3.


Note: This assumes the dates in column A are sorted in ascending order.

VLOOKUP:

=VLOOKUP(H3,A:E,5,TRUE)

This requires the dates in Column A to be sorted.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM