# Thread: count/sum array formula (excel2003)

1. ## count/sum array formula (excel2003)

hi all,
what I have is different names in column a, in column b are different types for each name. what I want to do is treat three types gp,gpk,gpkf as being one type and i want to get their count and their value sum in column g2 & h2 for each name. can one name be defined for these three types and then do the count and the sum operations?

regards,
dubdub

2. ## Re: count/sum array formula (excel2003)

An alternate approach if you want to check that the first 2 letters in column B are "gp" is to use:

=SUM(IF((\$A\$2:\$A\$15=\$F5)*(LEFT(\$B\$2:\$B\$15,2)="gp") ,1))
=SUM(IF((\$A\$2:\$A\$15=\$F5)*(LEFT(\$B\$2:\$B\$15,2)="gp") ,\$C\$2:\$C\$15))

Steve

3. ## Re: count/sum array formula (excel2003)

many thanks steve.
one minor correction to the first formula, one more \$ sign for the B range

=SUM(IF((\$A\$2:\$A\$15=\$F2)*((\$B\$2:\$B\$15="gp")+(\$B\$2: \$B\$15="gpk")+(\$B\$2:\$B\$15="gpkf")),1))

dubdub

4. ## Re: count/sum array formula (excel2003)

many thanks to you Steve.

Same results and less headache to track and to enter these type names.

dubdub

5. ## Re: count/sum array formula (excel2003)

<P ID="edit" class=small>(Edited by sdckapr on 06-Apr-07 05:27. Edited to allow copying and add forgotten dollar sign)</P>You were very close (I also cleaned up some unneccessary parentheses)
In G2 the array (cntrl-shift-enter):

=Sum(IF((\$A\$2:\$A\$15=\$F2)*((\$B\$2:\$B\$15="gp")+(\$B\$2: \$B\$15="gpk")+(\$B\$2:\$B\$15="gpkf")),1))

You can't "count" the items in A since A has no numbers, you can't use "Counta" since both 1s and zeroes will be counted.

In H2:
=SUM(IF((\$A\$2:\$A\$15=\$F2)*((\$B\$2:\$B\$15="gp")+(\$B\$2: \$B\$15="gpk")+(\$B\$2:\$B\$15="gpkf")),\$C\$2:\$C\$15))

You want to sum the values in column C, not the values in Col A...

Steve

6. ## Re: count/sum array formula (excel2003)

<hr>one minor correction to the first formula, one more \$ sign for the B range<hr>

<img src=/S/blush.gif border=0 alt=blush width=15 height=15> that is why I get for editing the text afterwards.... I have corrected my post

Steve

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•