# Excel conditional adding of cells

I receive a spread sheet with a field with mixed case and more characters than needed.
I have cleaned it up and now would like to add the values in column D when the values in column A are equal and also the values in Column C.
Some times there is only one value in column A and sometimes there are several.
Is there an IF statement that will work by copying into each cell or is a more involved macro needed.
###### Who is Participating?

Commented:
first let me restate what I think you are asking for...

Sum up the values in column D.... where the values in column A .... AND the values in Column C match?

If that is what you want you can use the following formula in column E1 and fill down.

=SUMPRODUCT(--(A:A=A1),--(C:C=C1),(D:D))
0

Commented:
Can you post a sample please?
0

Author Commented:
Thought I had attached a part of the file, guess not.
monthlyWB.xlsx
0

EngineerCommented:
Enter this in A1 and copy down

=SUMIF(A:A,A1,D:D)
0

EngineerCommented:
Or for more clarity use

=IF(A1<>A2,SUMIF(A:A,A1,D:D),"")
0

Commented:
You could use a pivot table to do this easily

Let me know if you need clarification
Copy-of-monthlyWB.xlsx
0

Author Commented:
Is there any way to enter the sum only once? If not, no problem. This does what I need.
0

Commented:
Try this version so that you don't get repeat values, SUMIFS is more efficient than SUMPRODUCT, too

=IF(COUNTIFS(A\$1:A1,A1,C\$1:C1,C1)=1,SUMIFS(D:D,A:A,A1,C:C,C1),"")

regards, barry
0

Author Commented:
Great thanks, but I already gave away all of the points.
0

Commented:
No problem

regards, barry
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.