Pull the price before a certain date

asharma

New Member
Joined
Jun 9, 2020
Messages
12
Office Version
  1. 2013
Platform
  1. Windows
Hello all Excel Gurus,
I need help in pulling the price paid BEFORE a particular date. I am attaching 2 sample spreadsheets. One is the price sheet for a particular claim product ID and the date when the price was paid. The second sheet is the "Date of Service" sheet where I need to pull the price paid BEFORE the date of service but only pull the price that was right before the date of service. In the "Date of Service" sheet, I've manually entered the price paid right before the date of service 3/2/18 (3523.23). That was the purchase price paid on 2/26/18, right before 3/2/18. I have 40,000 rows that I need to do this for. Any help would be greatly appreciated.

Price Sheet.xlsx
ABC
1Claim Product IDDatePrice
25024200870102/06/2018$3,523.23
35024200870102/13/2018$3,523.23
45024200870102/13/2018$3,523.23
55024200870102/13/2018$3,523.23
65024200870102/21/2018$3,523.23
75024200870102/26/2018$3,523.23
85024200870103/06/2018$3,523.23
95024200870103/06/2018$3,523.23
105024200870103/27/2018$3,523.23
115024200870104/24/2018$3,525.39
125024200870105/16/2018$3,525.39
135024200870105/22/2018$3,525.39
145024200870106/04/2018$3,525.39
155024200870108/20/2018$3,570.44
165024200870108/27/2018$3,570.44
Sheet3



Date of service.xlsx
ABC
1Clm Product IDDate of ServicePrice
2502420087013/2/2018$ 3,523.23
3502420087013/2/2018
4502420088013/2/2018
5502420087013/23/2018
6502420087013/23/2018
7502420088013/23/2018
8502420088015/24/2018
9502420088015/24/2018
10502420088015/24/2018
Sheet1
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hi,

If your Dates in Sheet 3 are in Ascending order:

Book1
ABC
1Clm Product IDDate of ServicePrice
2502420087013/2/20183523.23
3502420087013/2/20183523.23
4502420088013/2/2018Not Found
5502420087013/23/20183523.23
6502420087018/25/20183570.44
7502420088013/23/2018Not Found
8502420088015/24/2018Not Found
9502420088015/24/2018Not Found
10502420088015/24/2018Not Found
Sheet1
Cell Formulas
RangeFormula
C2:C10C2=IFERROR(LOOKUP(2,1/(FIND(A2,Sheet3!A$2:A$16)*(Sheet3!B$2:B$16<=B2)),Sheet3!C$2:C$16),"Not Found")


Book1
ABC
1Claim Product IDDatePrice
2502420087012/6/20183523.23
3502420087012/13/20183523.23
4502420087012/13/20183523.23
5502420087012/13/20183523.23
6502420087012/21/20183523.23
7502420087012/26/20183523.23
8502420087013/6/20183523.23
9502420087013/6/20183523.23
10502420087013/27/20183523.23
11502420087014/24/20183525.39
12502420087015/16/20183525.39
13502420087015/22/20183525.39
14502420087016/4/20183525.39
15502420087018/20/20183570.44
16502420087018/27/20183570.44
Sheet3
 
Upvote 0
Solution
That worked! You're a genius my friend. Thank you so much!
 
Upvote 0
You're welcome, thanks for the feedback.

Don't forget to mark the post that solved your question as Solution, Thanks.

In case you have IDs that are Different in character length (i.e. 12345, 123456, 1234567, etc.), this modified version of my formula will be More reliable:

Excel Formula:
=IFERROR(LOOKUP(2,1/((Sheet3!A$2:A$16=A2)*(Sheet3!B$2:B$16<=B2)),Sheet3!C$2:C$16),"Not Found")
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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