Formula to get data from a column based on a date range

Nowherefast

New Member
Joined
May 18, 2009
Messages
23
Hello:

I've been trying to create a formula to get the following info but have not had much luck.

I have 2 files and I need to populate the promo price from one file to another based on matching of the item number and then date range
See example below


[TABLE="width: 650"]
<colgroup><col><col><col><col span="2"><col span="2"><col><col></colgroup><tbody>[TR]
[TD][TABLE="width: 650"]
<colgroup><col><col><col><col span="2"><col span="2"><col><col></colgroup><tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Item[/TD]
[TD]Sale Date[/TD]
[TD]Get Promo Price[/TD]
[TD][/TD]
[TD]Item[/TD]
[TD]Start Date[/TD]
[TD]End Date[/TD]
[TD]Promo Price[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]1123[/TD]
[TD="align: right"]4/1/2018[/TD]
[TD] 15[/TD]
[TD][/TD]
[TD="align: right"]1123[/TD]
[TD="align: right"]1/1/2018[/TD]
[TD="align: right"]3/1/2018[/TD]
[TD="align: right"]5[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]5665[/TD]
[TD="align: right"] 6/15/2018[/TD]
[TD] null[/TD]
[TD][/TD]
[TD="align: right"]1123[/TD]
[TD="align: right"]3/15/2018[/TD]
[TD="align: right"]3/31/2018[/TD]
[TD="align: right"]10[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]1123[/TD]
[TD="align: right"]4/1/2018[/TD]
[TD="align: right"]6/1/2018[/TD]
[TD="align: right"]15[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]5665[/TD]
[TD="align: right"]1/1/2018[/TD]
[TD="align: right"]5/1/2018[/TD]
[TD="align: right"]3.99[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]5665[/TD]
[TD="align: right"]7/1/2018[/TD]
[TD="align: right"]9/1/2018[/TD]
[TD="align: right"]7.99[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]So I need to populate "Get promo price". In the example, for item 1123, it would be $15 and then for ITem 5665 it would be "null"

Hope I make sense?

Thank you.
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="width: 650"]
<colgroup><col><col><col><col span="2"><col span="2"><col><col></colgroup><tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
This array formula might serve your purposes.


Book1
ABCDEFGH
1ItemSale DateGet Promo PriceItemStart DateEnd DatePromo Price
211234/01/181511231/01/183/01/185
356656/15/18011233/15/183/31/1810
411234/01/186/01/1815
556651/01/185/01/183.99
656657/01/189/01/187.99
Sheet32
Cell Formulas
RangeFormula
C2{=MAX((A2=$E$2:$E$6)*(B2>=$F$2:$F$6)*(B2<=$G$2:$G$6)*$H$2:$H$6)}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Hi,

Another way:


Book1
ABCDEFGH
1ItemSale DateGet Promo PriceItemStart DateEnd DatePromo Price
211234/1/20181511231/1/20183/1/20185
356656/15/2018011233/15/20183/31/201810
411234/1/20186/1/201815
556651/1/20185/1/20183.99
656657/1/20189/1/20187.99
Sheet243
Cell Formulas
RangeFormula
C2=SUMPRODUCT((E$2:E$6=A2)*(F$2:F$6<=B2)*(G$2:G$6>=B2)*H$2:H$6)
 
Upvote 0
Also a SUMIFS option:


Book1
ABCDEFGH
1ItemSale DateGet Promo PriceItemStart DateEnd DatePromo Price
211234/1/20181511231/1/20183/1/20185
356656/15/2018011233/15/20183/31/201810
411234/1/20186/1/201815
556651/1/20185/1/20183.99
656657/1/20189/1/20187.99
Sheet243
Cell Formulas
RangeFormula
C2=SUMIFS(H$2:H$6,E$2:E$6,A2,F$2:F$6,"<="&B2,G$2:G$6,">="&B2)
 
Upvote 0

Forum statistics

Threads
1,223,710
Messages
6,174,017
Members
452,542
Latest member
Bricklin

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