Adding value to total depending on the value of the cell

jdbwizzard

New Member
Joined
Aug 15, 2014
Messages
2
Hello,
I am trying to work out a formula for the example spreadsheet below.
ItemCostCategory
Kroger1002
Gas503
Movies354
Phone Bill1701
Category 1 Total?
Category 2 Total?
Category 3 Total?
Category 4 Total?

<tbody>
</tbody>

I am trying to write a if statment that says if the category is 1 add to the category 1 total, if the category is 2 add to the category 2 total and so on.
So far this is what I came up with:
=IF(C2=1,B2+C7,IF(C2=2,B2+C8,IF(C2=3,B2+C9,B2+C10)))
But this only pulls from one cell. Thanks in advance for any help.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
you need a sumif

This will sum the cost if the category = 1

Change to red "1" to sum for a different category

=SUMIF($C$2:$C$5,1,$B$2:$B$5)
 
Upvote 0
Thank you for the quick response and sorry for the newbie question. I'm just getting into excel and don't know all of the functions yet.
 
Upvote 0

Forum statistics

Threads
1,216,073
Messages
6,128,644
Members
449,461
Latest member
kokoanutt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top