Sum of all values found in vlookup

MVI MIS

New Member
Joined
Oct 2, 2018
Messages
6
Hello,

I have a pivot table and an array. The pivot table has an Invoice Num (eg. 22885) and a product cost. The pivot table data is pulled from an external source (SQLDB).

The array contains an Invoice Num (eg. 22885) and any freight charges that are incurred against that number. Sometimes, more than one freight charge is incurred and it becomes a 2nd line (having the Invoice Num in the proper column)

I'd like to create a field that does a vlookup of the Invoice Num on the Pivot table and return the sum of all freight to that invoice number.

Example: Pivot table has 22885 as the invoice num. The array has 2 invoice num fields that match, 200, and 45.50. I'd like the field to say 245.50

Here is the current formula I'm using, but it doesn't seem to be catching ALL the values, just the first:
Code:
=IFERROR(VLOOKUP([I]INVOICENUM[/I],'[I]SHEETWITHFREIGHTARRAY[/I]'!P:R,3,0),0)

I tried adding SUM to the formula, with no avail:
Code:
=IFERROR(SUM(VLOOKUP([I]INVOICENUM[/I],'[I]SHEETWITHFREIGHTARRAY[/I]'!P:R,3,0)),0)

Any ideas on how to accomplish this?
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Try using SUMIF(S) or SUMPRODUCT instead of VLOOKUP.
 
Upvote 0
Welcome to the forum.

=SUMIF('SHEETWITHFREIGHTARRAY'!P:P,INVOICENUM,'SHEETWITHFREIGHTARRAY'!R:R)

should do the trick.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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