VLOOKUP Array to Sum Multiple Instances

paulrh

New Member
Joined
Nov 4, 2015
Messages
15
I have a simple warehouse stock workbook. One sheet has the parts inventory, a second sheet has the orders. The second sheet (called ORDERS) has orders fulfilled such that the part number is in the first column and the number ordered for that part in the fourth column.

I want the inventory sheet to sum up all orders of a particular part and subtract that from the inventory total.

This is the formula I have used on the inventory sheet (using row 32 as an example)

{=SUM(D32:F32) - IFNA(SUM(VLOOKUP(A32,ORDERS!$C$4:$F$20000,{4},FALSE)),0))

As you can see I have entered it as an array.

The IFNA removes the #N/A error if the part has never been ordered.

The SUM(D32:F32) is the incoming numbers for that part.

This formula appears to stop at the first instance of the part being encountered. I searched and see I am not the first person to have this issue and the formula I have used appears to match peoples suggested solutions but it still does not work.

Any ideas? Thanks :confused:
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Solved it!

=SUM(D2:F2) - SUMPRODUCT(SUMIF(INDIRECT("'"&ORDERS2&"'!"&"$C$4:$C$2000"),A2,INDIRECT("'"&ORDERS2&"'!"&"$F4:$F$20000")))


;)
 
Upvote 0
Not sure i understand your data setup.
See if this does what you need
=SUM(D32:F32) - SUMIF(ORDERS!$C:$C,A32,ORDERS!$F:$F)

M.
 
Upvote 0
Solved it!

=SUM(D2:F2) - SUMPRODUCT(SUMIF(INDIRECT("'"&ORDERS2&"'!"&"$C$4:$C$2000"),A2,INDIRECT("'"&ORDERS2&"'!"&"$F4:$F$20000")))

No need of SUMPRODUCT and INDIRECT. See my formula above.

M.
 
Upvote 0

Forum statistics

Threads
1,217,344
Messages
6,136,021
Members
449,978
Latest member
mtbe

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