Home » excel » excel – How to identify unique value instances and find the sum

excel – How to identify unique value instances and find the sum

Posted by: admin May 14, 2020 Leave a comment

Questions:

This question builds on my previous post regarding how to identify and output multiple instances of a found value. My previous post:
Array to lookup multiple columns and take another columns information

This question is slightly different, where what if I wanted to sum the values found in an array. I have presented an example below. The Table I2:J4 is the reference table which assigns a value to each Plant #. Cells B3:F9 are already filled in and are used to find the sum of one count of each instance in the row. Column A will show the solution of each row. The formula should allow the column to be populated automatically.

enter image description here

For example I have filled in the answer for the first three rows of Column A. In Row 3, we see that there is a Plant 1002B1, and 1003B1 so the answer is 200+300. We neglect any additional instances found of a Plant #. For example row 4 and 5 both have a sum of 100, regardless of how many instances of the same plant are found.

I found myself trying to use an Index but this would return True/False values and because of this you can’t add the sum of the value. Unless you use the True/False to identify the location of the value in the reference table and use that to find that the sum, which I dont how to do.

How to&Answers:

Use this array formula

=SUM(IF(B2:F2<>"",IF(MATCH(B2:F2,B2:F2,0)=COLUMN(B2:F2)-MIN(COLUMN(B2:F2))+1,SUMIFS(J:J,I:I,B2:F2))))

Being an array formula it must be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.

enter image description here


If one has the new Dynamic Array formula(currently only available to Office 365 Insiders) then it gets much simpler to get an array of unique entries:

=SUMPRODUCT(SUMIFS(J:J,I:I,UNIQUE(TRANSPOSE(B2:F2))))

enter image description here