Solved

# How can I use a SUM IF FREQUENCY formula with TWO additional criteria?

Posted on 2011-05-12
298 Views
Hello Experts.  I need your help modifying a previous solution.  (Ref:  http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_27018532.html)

I have been using the SUM IF FREQUENCY formula with some success (see attached sample file).  I need help modifying it to take into account other criteria.

I am working with a large legacy report to extract summaries.  I have many duplicate entries.  Using the SUM IF FREQUENCY I have been able to count the quantity of unique entries (orders & deliveries – columns E & F).  You already helped me develop a formula to count the quantity of unique entries within each delivery (see I42).

Now I need to add criteria to that formula to also count when the Quantity (Col Y) changes within an Item Number.

Can you give me a hand?

Gary

BCIWSH-Deliveries-and-Lines--S-0.xls
0
Question by:garyrobbins

LVL 50

Accepted Solution

Hello Gary, try these versions - for count

=SUMPRODUCT((MATCH(E8:E38&"-"&I8:I38&"-"&Y8:Y38,E8:E38&"-"&I8:I38&"-"&Y8:Y38,0)=ROW(E8:E38)-ROW(E8)+1)+0)

and then for sum....

=SUMPRODUCT((MATCH(E8:E38&"-"&I8:I38&"-"&Y8:Y38,E8:E38&"-"&I8:I38&"-"&Y8:Y38,0)=ROW(E8:E38)-ROW(E8)+1)+0,Y8:Y38)

regards, barry
0

Author Closing Comment

Barry -- you are a wizard!

Could you give me a short description of how this count formula works?  Mainly the MATCH function inside...

Thanks, Gary
0

LVL 50

Expert Comment

What the MATCH function is doing is matching each concatenation of the relevant cells in each row against a range of ALL such concatenations. Because MATCH finds the position of the first match then that number will always be the same for each similar concatenation, e.g. if you have "x", "y", "z" in row 8 and also in row 15 and 25 then the MATCH function will return 1 (because 8 is the first match and that's row 1 of the range) for all of these.......so we compare the match function result against the relative row number in the range ( provided by ROW( rather than just count.E8:E38)-ROW(E8)+1) so this is 1 in row 8, 8 in row 15 and 18 in row 25....so for my example there's only a match for row 8.......i.e. only the first row of identical combinations is counted.

For the second formula a sum range is added to sum column Y rather than just count

does that make sense, it's quite a complex concept....

regards, barry
0

Author Comment

0

## Featured Post

A2 = A1 That kind of cell reference is relative.  If you copy it from A2 to B2, then B2 will get this: B2 = B1 That's all fine and good, but if you then insert a new row above row 2, you'll find: A3 = A1 B3 = B1 This is intentional. …
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.