MAXIF Array using sum of duplicate value and known value

ericdb

New Member
Joined
Dec 10, 2013
Messages
18
Hello, I am trying to figure out how to create a MAXIF Array function using duplicated value sums, and a known criteria value.

Example:
I have a shipment report that shows parts shipped down to a part and serial number. I need to summarize the data by part number showing only the largest shipment qty by part number. The report has duplicated lines for order number and part number due to the serial numbers. I need an array function that will sum all of the part numbers (known value) for each order number, and provide the max value. In the Table example, i would need Max for Part1 to be 5 (order one shipped 5) and Part2 to be 4 (order two shipped 4).

Order NumberPart NumberSerial Number
1
Part1

<tbody>
</tbody>
12345
1
Part1

<tbody>
</tbody>
23456
1
Part1

<tbody>
</tbody>
34567
1
Part1

<tbody>
</tbody>
45678
1
Part1

<tbody>
</tbody>
56789
1
Part 2

<tbody>
</tbody>
67890
1
Part 2

<tbody>
</tbody>
78901
1
Part 2

<tbody>
</tbody>
89012
2
Part 2

<tbody>
</tbody>
90123
2
Part 2

<tbody>
</tbody>
01234
2
Part 2

<tbody>
</tbody>
98765
2
Part 2

<tbody>
</tbody>
87654
2
Part1

<tbody>
</tbody>
76543
3
Part1

<tbody>
</tbody>
65432
3
Part1

<tbody>
</tbody>
54321
3
Part 2

<tbody>
</tbody>
43210
3
Part 2

<tbody>
</tbody>
32109

<tbody>
</tbody>


Any help would be greatly appreciated.

Thanks!
Eric
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Not sure if there is a simpler way to do this, but this seems to work.

I copied your info into range A1:C18.

In D2 I have this formula, =COUNTIFS($A$2:$A$18,A2,$B$2:$B$18,B2)
In E3 I have this formula, =MAX(IF($A$2:$A$18=A2,$D$2:$D$18))=D2, this is an array formula, Ctrl+Shift+Enter

Copy both of the formulas down.
Then create a pivot table with the new columns.
Rows should have Order Number and Part Number.
Values should have Count of Part Number.
Then add Column E, whatever you named it on your main sheet, to the Filters section. Then go to your pivot table and select TRUE for the filter you just added.
 
Upvote 0
If column A (OrderNumber) is numeric, not alphanumeric, try this


A
B
C
D
E
F
1
Order Number​
Part Number​
Serial Number​
Part Number​
Result​
2
1​
Part1​
12345​
Part1​
5​
3
1​
Part1​
23456​
Part 2​
4​
4
1​
Part1​
34567​
5
1​
Part1​
45678​
6
1​
Part1​
56789​
7
1​
Part 2​
67890​
8
1​
Part 2​
78901​
9
1​
Part 2​
89012​
10
2​
Part 2​
90123​
11
2​
Part 2​
1234​
12
2​
Part 2​
98765​
13
2​
Part 2​
87654​
14
2​
Part1​
76543​
15
3​
Part1​
65432​
16
3​
Part1​
54321​
17
3​
Part 2​
43210​
18
3​
Part 2​
32109​

Array formula in F2 copied down
=MAX(FREQUENCY(IF(B$2:B$18=E2,A$2:A$18),A$2:A$18))
Ctrl+Shift+Enter

M.
 
Upvote 0
Hello Marcelo, Thank you for the response. The order number is actually alpha numeric. Sorry for not specifying.
 
Upvote 0
Not sure if there is a simpler way to do this, but this seems to work.

I copied your info into range A1:C18.

In D2 I have this formula, =COUNTIFS($A$2:$A$18,A2,$B$2:$B$18,B2)
In E3 I have this formula, =MAX(IF($A$2:$A$18=A2,$D$2:$D$18))=D2, this is an array formula, Ctrl+Shift+Enter

Copy both of the formulas down.
Then create a pivot table with the new columns.
Rows should have Order Number and Part Number.
Values should have Count of Part Number.
Then add Column E, whatever you named it on your main sheet, to the Filters section. Then go to your pivot table and select TRUE for the filter you just added.

Thanks Irobbo314 for the reply. I am actually trying to add this to a very large table as a field to build more functions off of for stocking levels, so single column results is how I really need this to work.
 
Upvote 0
Hello Marcelo, Thank you for the response. The order number is actually alpha numeric. Sorry for not specifying.

Try this array formula instead in F2 copied down
=MAX(FREQUENCY(IF(B$2:B$18=E2,MATCH($A$2:$A$18,$A$2:$A$18,0)),ROW($A$2:$A$18)-ROW(A$2)+1))
Ctrl+Shift+Enter

M.
 
Upvote 0
For. a single formula try this

=MAX(COUNTIFS(B$2:B$18,E2,A$2:A$18,A$2:A$18))

confirm with CTRL+SHIFT+ENTER
 
Upvote 0
Try this array formula instead in F2 copied down
=MAX(FREQUENCY(IF(B$2:B$18=E2,MATCH($A$2:$A$18,$A$2:$A$18,0)),ROW($A$2:$A$18)-ROW(A$2)+1))
Ctrl+Shift+Enter

M.

Awesome Marcelo!! This works perfectly. I tried to do something similar but it did not work, and was trying to merge a SUM with Frequency, with MAX.

Thanks Again!!!
 
Upvote 0

Forum statistics

Threads
1,214,922
Messages
6,122,281
Members
449,075
Latest member
staticfluids

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