# conditional sum?

L

#### Lamb Chop

A1= Apple B1 =12
A2= Orange B2 = 52
A3 = Orange B3= 51
A4=Banana B4=53
A5 =grape B5=43
A6=grape B6 = 6
A7=grape B7 = 88

In the C column I'd like to add the number from B column if A column the
same.

The end result will look like:

C1= 12
C2 = 52+ 51 (as A2 and A3 both are orange so add B2 and B3
together)
C3= "" (leave it blank as C2 already did the job)
C4=53
C5 = 43+6 +88 (as A5, A6 and A7 are all grape, so add B5 to B7
together)
C6 = ""
C7 =""

so the outcome will look like this:

A1= Apple B1 =12 C1=12
A2= Orange B2 = 52 C2=103
A3 = Orange B3= 51 C3=
A4=Banana B4=53 C4=53
A5 =grape B5=43 C5=137
A6=grape B6 = 6 C6=
A7=grape B7 = 88 C7=

Any suggesion?

Thanks

S

#### Sandy Mann

Try:

=IF(COUNTIF(\$A\$1:A1,A1)=1,SUMIF(\$A\$1:\$A\$7,A1,\$B\$1:\$B\$7),"")

and drag down on the fill handle

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

Replace @mailinator.com with @tiscali.co.uk

M

#### Max

One way
In C1: =IF(A1="","",SUMIF(A:A,A1,B:B))
In D1: =IF(COUNTIF(\$A\$1:A1,A1)>1,"",C1)
Select C11, copy down. Hide away col C.
Col D returns the required results.