Retrieve last non-empty cell based on date criteria

Rostyslav

New Member
Joined
Apr 9, 2014
Messages
4
Hi. I have difficulties with resolving the following issue:

I have the prices for the Product #1 that are monthly revised (Table _ Primary data). Some months are blank, that means there were no price review in this period (e.g. as of 3/1/2019), thus, the price of previous month remains actual. I could not delete the blank row, but it could be left empty or filled with number 0 if it could be helpful (now I have empty cell in TEXT format).
Now I have table below (Table _ Calculated result) where I have different dates. In the second column of this table I need to retrieve from the "Table _ Primary data" the last actual price for each responsible dates (expected results are given in example).

Are there any ways to do it with formula (ideally without array formula as there are huge range of products and dates)?
Just in case I provide link to google spreadsheet with provided data below https://docs.google.com/spreadsheets/d/1r-zM34RKrdEi0Fc4r4B0jyFSPymWDNPvJ9k6o8BkMwo/edit?usp=sharing

Thank you for any help in this challenging task for me

Primary data
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Date[/TD]
[TD]Revised price for Product #1 , $[/TD]
[/TR]
[TR]
[TD]1/1/2019[/TD]
[TD]180[/TD]
[/TR]
[TR]
[TD]2/1/2019[/TD]
[TD]200[/TD]
[/TR]
[TR]
[TD]3/1/2019[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4/1/2019[/TD]
[TD]210[/TD]
[/TR]
</tbody>[/TABLE]

Calculated result
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Date[/TD]
[TD]Current price for Product #1 , $[/TD]
[/TR]
[TR]
[TD]1/15/2019[/TD]
[TD]180[/TD]
[/TR]
[TR]
[TD]2/15/2019[/TD]
[TD]200[/TD]
[/TR]
[TR]
[TD]3/15/2019[/TD]
[TD]200[/TD]
[/TR]
[TR]
[TD]4/15/2019[/TD]
[TD]210[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Are there any ways to do it with formula (ideally without array formula as there are huge range of products and dates)?

Hi, whilst not needing entering with CSE, this is in fact an array processing formula, so input ranges should be limited as much as possible. This also assumes that you primary data is sorted by the date column.


Excel 2013/2016
BC
2Primary data
3Date (mm/dd/yyyy)Revised price for Product [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1]#1[/URL] , $
401/01/2019180
502/01/2019200
603/01/2019
704/01/2019210
8
9Calculated result
10Date (mm/dd/yyyy)Current price for Product [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1]#1[/URL] , $
1101/15/2019180
1202/15/2019200
1303/15/2019200
1404/15/2019210
Sheet1
Cell Formulas
RangeFormula
C11=LOOKUP(B11,$B$4:$B$7/($C$4:$C$7<>""),$C$4:$C$7)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top