Nested VLOOKUP in an IF statement

jlcochran38

New Member
Joined
Jun 11, 2016
Messages
9
I need some help with a formula (see tables below). What I need is for the Reference ID in the first table to lookup the Reference ID in the second table, and if the date range for that Reference ID in the first table falls inside one the date ranges within the second table, the price needs to show.

Reference IDProduct NameStart DateEnd DatePrice
00123Product ABCD10/1/201610/31/2016$59.00

<tbody>
</tbody>

Reference IDProduct NamePriceStart DateEnd Date
00123Product ABCD182.007/1/20186/30/2019
00124Product EFGH75.007/1/20156/30/2017
00124Product EFGH64.007/1/20176/30/2018
00124Product EFGH87.007/1/20186/30/2019
00123Product ABCD59.007/1/20156/30/2017
00123Product ABCD24.007/1/20176/30/2018

<tbody>
</tbody>
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
If you're sure you won't have multiple prices in the same range, you can use a SUMIFS:

ABCDEFG
1Reference IDProduct NameStart DateEnd DatePrice
2123Product ABCD10/1/201610/31/2016$59.00
3
4Reference IDProduct NamePriceStart DateEnd Date
5123Product ABCD1827/1/20186/30/2019
6124Product EFGH757/1/20156/30/2017
7124Product EFGH647/1/20176/30/2018
8124Product EFGH877/1/20186/30/2019
9123Product ABCD597/1/20156/30/2017
10123Product ABCD247/1/20176/30/2018
11

<tbody>
</tbody>
Sheet21

Worksheet Formulas
CellFormula
E2=SUMIFS($C$5:$C$10,$A$5:$A$10,A2,$D$5:$D$10,"<="&C2,$E$5:$E$10,">="&D2)

<tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
Your formula works fine, but when I try to transcribe it into my spreadsheet (changing the reference locations) it doesn't seem to work anymore.

=SUMIFS('Contract Pricing All'!$C$2:$C$7,'Contract Pricing All'!$A$2:$A$7,Recovered_Sheet1!A2,'Contract Pricing All'!$D$2:$D$7,"<="&Recovered_Sheet1!C2,'Contract Pricing All'!$E$2:$E$7,">="&Recovered_Sheet1!D2)
 
Upvote 0
When you say "doesn't seem to work" what do you mean? Returns an error, or zero value, or wrong value?

I renamed the sheets in my test workbook to match your formula, then pasted it exactly as you wrote it, and I got the right response. Just make sure that the ranges are correct, and the sheet names are too (spaces vs. underlines).
 
Upvote 0
I'm not sure what else to tell you. It works fine in my workbook, even using the formula you provided in post 3. Make sure that your ranges are correct, make sure that the dates are actual dates, not text, and try again.
 
Upvote 0
It looks like the latter is the issue. This is not my spreadsheet, but whoever used it last used some jacked up formatting on the dates...some even having spacing. That's probably the issue.
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,718
Members
448,986
Latest member
andreguerra

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