Product Totals

Lucy89

Board Regular
Joined
Jan 25, 2009
Messages
88
Hi please see the photo in the link;

https://ibb.co/RPmLYTz

Is it possible so that A16:A24 will display a product code and C16:C24 will show the total amount of each product?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Lucy89,

The tricky part here is getting the list of unique Product Codes (as I assume you do not yet have access to the new UNIQUE function).

This solution:
  1. Assumes your Product Codes are in A2 through A12 (as suggested by the screenshot).
  2. Requires that cell A15 does not contain a value which may match a Product Code.
  3. The longer formula with INDEX MATCH and COUNTIF is an array formula so must be entered using Ctrl-Shift-Enter so that Excel automatically generate the curly brackets. The SUMIFS just needs to be entered with the Enter key.

A
B
C
1
Product Codes
Parts Used
2
SBR 2574
3
FSD 0145
4
FSD 0144
5
SBR 0011
6
SPR 3855
7
SBR 2571
8
16
SBR 2575
17
FSD 0149
18
SBR 0011
19
SPR 3855
20
21
22
23
24

<colgroup><col><col><col></colgroup><tbody>
</tbody>

Cell A16 contains
=IFERROR(INDEX($A$2:$A$12, MATCH(0, COUNTIF($A$15:A15, $A$2:$A$12&"") + IF($A$2:$A$12="",1,0), 0)), "")
which is entered using CTRL-Shift-Enter to generate
{=IFERROR(INDEX($A$2:$A$12, MATCH(0, COUNTIF($A$15:A15, $A$2:$A$12&"") + IF($A$2:$A$12="",1,0), 0)), "")}
Copy down to A24

Cell C16 contains
=IF(A16="","",SUMIFS($C$2:$C$12,$A$2:$A$12,A16))
Copy down to C24
 
Upvote 0
Toadstool thank you thank you thank you! This is perfect, fantastic :)

I like to think I know a little about excel formulas but what’s all this curly brackets thing about please?
 
Upvote 0
Lucy,

An Array Formula lets you take a function which normally just acts on one cell and have it execute across a range of cells. It's important to note you can't type in those curly brackets as it's the Ctrl-Shift-Enter which tells Excel to treat it as an array formula and Excel puts in the curly brackets to show it has done so.
The Microsoft explanation may help and it can be found here: Array Formulae


If you'd rather avoid array formulae (which can be slow to run) then here's an alternative. Just enter
=IFERROR(INDEX($A$2:$A$12,MATCH(0,INDEX(COUNTIF($A$15:A15,$A$2:$A$12&""),),0)),"")
into A16 and copy down to A24. The SUMIFS statement in column C is unchanged.


ABC
1Product CodesParts Used
2SBR 2574
3FSD 0145
4FSD 0144
5SBR 0011
6SPR 3855
7SBR 2571
8
12
15
16SBR 2575
17FSD 0149
18SBR 0011
19SPR 3855
20

<tbody>
</tbody>
ProductCodes

Worksheet Formulas
CellFormula
A16=IFERROR(INDEX($A$2:$A$12,MATCH(0,INDEX(COUNTIF($A$15:A15,$A$2:$A$12&""),),0)),"")
C16=IF(A16="","",SUMIFS($C$2:$C$12,$A$2:$A$12,A16))

<tbody>
</tbody>

<tbody>
</tbody>


Regards,
Toadstool
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,849
Members
449,051
Latest member
excelquestion515

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