Complex If and Nested Vlookup formulas

kingstreasure

New Member
Joined
Jun 10, 2011
Messages
7
Hi

Hopefully I explained this correctly so that someone understands my madness.

I have an excel worksheet that contains IF and nested VLOOKUP formulas throughout numerous cells in a tab named SummaryWk. That sheet is populated with data from the SummaryData tab, based on the delivery date the quantities are updated in the appropriate weekly bucket (similar to a pivot table) in the SummaryWk tab. The formula works for the most part, but for some reason if the error statement is true it doesn't return a value under the weekly buckets.


SummaryData - *I have other columns in between, I just wanted to show the main fields with the column names for the formula since its complex.
AFLU
1JoinKeyTracking#Delivery DateQuantity
2ABCDEFG1234562223333311/20/2014434,556
3ABCDEFG1222231234321111/9/201442,444
4ABCDEFG1244444441123411/23/2014333,442
5ABCDEFG1241112334566611/16/20141,223

<tbody>
</tbody>

SummaryWk - *depending on the accounting period columns U through X will at times not have data, that is why W and X show "#VALUE!"
AFUVWXYZ
1JoinKeyTracking#11/9/201411/16/2014#VALUE!#VALUE!11/23/201412/23/2014
2ABCDEFG12345622233333
3ABCDEFG1222231234321142,444
4ABCDEFG12444444411234333,442
5ABCDEFG124111233456661,223

<tbody>
</tbody>

I'm not sure what needs to be changed within my formula:

Cell U2 = IF(AND(ISERROR($U$1), ISERROR($V$1)), 0, IF(AND(ISERROR($V$1),VLOOKUP(A2,SummaryData!$A$2:$U$3206,12,FALSE)>=$U$1,VLOOKUP(A2,SummaryData!$A$2:$U$3206,12,FALSE)<$Y$1),VLOOKUP(A2,SummaryData!$A$1:$U$3206,21,FALSE),IF(ISERROR($V$1),0,IF(AND(VLOOKUP(A2,SummaryData!$A$2:$U$3206,12,FALSE)>=$U$1,VLOOKUP(A2,SummaryData!$A$2:$U$3206,12,FALSE)<$V$1),VLOOKUP(A2,SummaryData!$A$2:$U$3206,21,FALSE),0))))

The above formula is used in cells V2 and W2

Cell X2
=IF(ISERROR($X$1), 0, IF(AND(VLOOKUP(A2,SummaryData!$A$2:$U$4965,12,FALSE)>=$X$1, VLOOKUP(A2,SummaryData!$A$2:$U$4965,12,FALSE)<$Y$1), VLOOKUP(A2,SummaryData!$A$2:$U$4965,21,FALSE),0))

Cell Y2 = IF(AND(VLOOKUP(A2,SummaryData!$A$2:$U$4965,12,FALSE)>=$Y$1, VLOOKUP(A2,SummaryData!$A$2:$U$4965,12,FALSE)<$Z$1),VLOOKUP(A2,SummaryData!$A$2:$U$4965,21,FALSE),0)

Cell Z2 =IF(AND(VLOOKUP(A2,SummaryData!$A$2:$U$4965,12,FALSE)>=$Z$1, VLOOKUP(A2,SummaryData!$A$2:$U$4965,12,FALSE)<$AA$1),VLOOKUP(A2,SummaryData!$A$2:$U$4965,21,FALSE),0)
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
It looks like you are trying to extract data from "SummaryData " into SheeSummaryWk - cell that matches the "JoinKey", "Tracking#" and the date?

If this is correct, here's a simpler formula:
=SUMPRODUCT(--($A2='SummaryData '!$A:$A),--(SheeSummaryWk!$B2='SummaryData '!$B:$B),--(SheeSummaryWk!C$1='SummaryData '!$C:$C),'SummaryData '!$U:$U)

this formula was used in C2 in the "SheeSummaryWk" workbook, and you can copy and paste across your table.


<tbody>
</tbody>
here the file i mocked:
https://www.dropbox.com/s/v7es4of22uiou7o/Book1.xlsx?dl=0

hope this helps.

V
 
Upvote 0

Forum statistics

Threads
1,215,480
Messages
6,125,050
Members
449,206
Latest member
Healthydogs

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