Excel VBA-conditional statement

  • Thread starter Thread starter Marissa O
  • Start date Start date
M

Marissa O

I need to all the amounts in column E together based on the value i
column C.

EX if column C has product code 50 then I need it to add all amounts i
column e that go with that 50.

C E
50 100
40 10
50 30
80 40
60 20
40 4

product code 50 for the year costed $130
product code 40 for the year costed $14

Can someone help me with a formula for this
 
I put your sample data beginning in row 1 of columns C and E. In E8, put
the following:

=SUMIF(C1:C6,"=0"&C8,E1:E6)

In C8, enter the product code (40, 50, etc.) and the formula will give you
the desired result.

HTH

--
Michael J. Malinsky
Pittsburgh, PA

"I was gratified to be able to answer promptly,
and I did. I said I didn't know." -- Mark Twain
 
Michael

why not just:

=SUMIF(C1:C6,C8,E1:E6)

Regards

Trevor


Michael J. Malinsky said:
I put your sample data beginning in row 1 of columns C and E. In E8, put
the following:

=SUMIF(C1:C6,"=0"&C8,E1:E6)

In C8, enter the product code (40, 50, etc.) and the formula will give you
the desired result.

HTH

--
Michael J. Malinsky
Pittsburgh, PA

"I was gratified to be able to answer promptly,
and I did. I said I didn't know." -- Mark Twain
 
Back
Top