Excel 2013 Vlookup with multiple date ranges

ian machin

New Member
Joined
Jul 10, 2015
Messages
5
Hi All,
I am trying to use the Vlookup function to search for product costs from a list to match a sales order date. My downloaded sales data show the sales order delivery date , column "C" and I am trying to match the production costs with the correct date range , columns "N" and "O".
The cells in yellow range G5:H7 show would the expected result should be. Struggling to set the "only use the vlookup if the date range is correct"
Many thanks in advance.

Rich (BB code):
Excel 2012
ABCDEFGHIJKLMNO
1Sales TableLookup Table
2
3
4Product Product DescriptionDateQtyUnit PriceGross SalesProd Cost 1Prod Cost 2ProductProd Cost 1Prod Cost 2Date FromDate To
5935Gift Bag10/07/20152£10.00£20.004.002.00935£4.00£2.0005/07/201515/07/2015
6935Gift Bag20/07/20153£10.00£30.003.003.50935£3.00£3.5019/07/201531/07/2015
7936Gift Set12/07/20154£15.00£60.004.001.00936£4.00£1.0005/07/201531/12/2015
8937£5.00£1.5005/07/201531/12/2015
9938£3.50£2.0005/07/201531/12/2015
10939£2.00£4.0005/07/201531/12/2015
11940£1.00£1.5005/07/201531/12/2015
<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead> </thead><tbody> </tbody>
Sheet1


Ian Machin
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi Ian,

thought i had it but it fell through.
 
Last edited:
Upvote 0
Hi Ian,

This should be it.


Book1
ABCDEFGHIJKLMNO
1Sales TableLookup Table
2
3
4ProductProduct DescriptionDateQtyUnit PriceGross SalesProd Cost 1Prod Cost 2ProductProd Cost 1Prod Cost 2Date FromDate To
5935Gift Bag10-7-20152£10.00£20.004,002,00£4.00£2.00935£4.00£2.005-7-201515-7-2015
6935Gift Bag20-7-20153£10.00£30.003,003,50£3.00£3.50935£3.00£3.5019-7-201531-7-2015
7936Gift Set12-7-20154£15.00£60.004,001,00£4.00£1.00936£4.00£1.005-7-201531-12-2015
8937£5.00£1.505-7-201531-12-2015
9938£3.50£2.005-7-201531-12-2015
10939£2.00£4.005-7-201531-12-2015
11940£1.00£1.505-7-201531-12-2015
Sheet2
Cell Formulas
RangeFormula
I5=INDEX($L$5:$L$11,SUMPRODUCT(($K$5:$K$11=A5)*($N$5:$N$11<=C5)*($O$5:$O$11>=C5)*ROW($L$5:$L$11))*0)
J5=INDEX($M$5:$M$11,SUMPRODUCT(($K$5:$K$11=A5)*($N$5:$N$11<=C5)*($O$5:$O$11>=C5)*ROW($M$5:$M$11))*0)
 
Upvote 0
Thank you so much , I know we all like the excel challenge but this is greatly appreciated. Never considered that approach :)
Ian M
 
Upvote 0
G5, control+shift+enter, not just enter, copy across, and down:
Rich (BB code):

=INDEX($L$5:$M$11,MATCH(1,IF($K$5:$K$11=$A5,IF($C5>=$N$5:$N$11,
    IF($O$5:$O$11>=$C5,1))),0),MATCH(G$4,$L$4:$M$4,0))
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,053
Latest member
Mesh

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