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

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
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,215,375
Messages
6,124,583
Members
449,174
Latest member
chandan4057

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