# Excel 'If Then' or 'When' statement

OK, I'm doing some accounting in an excel spreadsheet where I list out all of my transactions. I then want to sum up the transactions depending on how they are labeled without sorting them or anything like that. Basically I'm wanting to come up with a formula to look at an entire column and determine if a number should be counted or not. Here's an example:

Col. A       Col. B
deposit     50.00
credit       100.00
credit       120.00
misc.        50.00
deposit     200.00
credit       25.00

Then in the totals section I'm wanting to see this:

deposits    250.00
credits      245.00
misc.        50.00

So for the deposits total I'm wanting to add up all of column b if column a says deposit, and the same for credits and misc. Is this possible? I've thought about making hidden columns where the totals show up if column a says a specific thing and then adding up that hidden column but then every time I come up with a new type for column a i'm going to have to create a new hidden column rather than just copy my formula over again.
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Hi,
You can use the SUMIF( ) function to sum on a criterion:

Say the transaction type is in A1:A100 and the amount in B1:B100
-In D1:D3, write the categories exactly the way they are entered in A1:A100 (no trailing 's'):
-In E1, enter the formula: =SUMIF(\$A\$1:\$A\$100,E1,\$B\$1:\$B\$100)
- copy E1 (menu Edit > Copy), select E2:E3, and paste (menu Edit > Paste)

Regards,
Sebastien
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
That worked great!!! Thanks Sebastien!

-marshall-
0
Commented:
Thanks for the points and grade, Marshall.  Glad i could help.
Sebastien
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.

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.