Sum contract invoices by supply category where multiple suppliers in the category

IKH104

New Member
Joined
Nov 14, 2014
Messages
2
I want to run a formula to look up a contract ref and run sum values for supplier invoices depending on their supply category as eg below - please advise formula - I reckon combo of vlookup, sumif, sumproduct???
Input
Output
Customer Contract Ref
Invoice Ref
Value
Supplier
Fruits
Veg
Customer Contract Ref
Fruits
Veg
10001
1
5000
Supplier A
Supplier A
Supplier B
10001
7000
300
10001
2
300
Supplier B
Supplier C

10002
7000
400
10001
3
2000
Supplier C
Supplier D

10003
1300
600
10002
4
400
Supplier B
10002
5
7000
Supplier A
10003
6
300
Supplier A
10003
7
100
Supplier A
10003
8
900
Supplier D
10003
9
600
Supplier B

<tbody>
</tbody>
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hi, good afternoon

Welcome to the board :)

This formula will work (copy it across and down), but there may be a more elegant way as my use of OFFSET is a little clumsy I fear. But should be good to get you going. You will need to change the references to suit, and ensure they all line up correctly.

Excel 2010
ABC
12Customer Contract RefFruitsVeg
13100017000300
14100027000400
15100031300600

<tbody>
</tbody>
Sheet1
Array Formulas
CellFormula
B13{=SUM($C$2:$C$10*($A$2:$A$10=$A13)*(COUNTIF(OFFSET($F$1, 1, MATCH(B$12, $F$1:$G$1, 0)-1, 1000, 1), $D$2:$D$10)>0))}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>

Hope that helps.

/AJ
 
Upvote 0
This should do it:

=SUMPRODUCT(SUMIFS($C$2:$C$10,$A$2:$A$10,$I2,$D$2:$D$10,F$2:F$4))
 
Upvote 0
J2, copy across and down:
Rich (BB code):
=SUM(INDEX(SUMIFS($C$2:$C$10,$D$2:$D$10,INDEX($F$2:$G$4,0,
  MATCH(J$1,INDEX($F$1:$G$1,1,0),0)),$A$2:$A$10,$I2),0))
 
Upvote 0

Forum statistics

Threads
1,215,225
Messages
6,123,732
Members
449,116
Latest member
Aaagu

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