How can I have Excel calculate SubTotals on a spreadsheet ... something like this:

Cars           2
Cars           5
Cars           8        15
Trucks       3
Trucks       1
Trucks       2
Trucks       7        13
etc

I have the first 2 columns, and want Excel to calculate the 15, 13, etc.
LVL 1
###### Who is Participating?

x
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.

Director of OperationsCommented:
Assuming your names are in column A and your values are in column B you can combine IF() and SUMIF() to get this result.

First we check if the value in A is the same as the value below it.  If not, then we sum all values if the name matches.
``````=IF(A1=A2,"",SUMIF(A:A,A1,B:B))
``````
propagated to each row would do the trick.

Sample excel attached.
ee29080351.xlsx

Experts Exchange Solution brought to you by

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:
Worked like a charm!
Thank you.
Finance AnalystCommented:
In addition to above suggestion, have you seen the SUBTOTAL feature on the Data Group tab.

You can tell excel to look for a change in a particular column of your data and add a subtotal (count or sum and others) to another column.

This will insert a row below each set of data and will populate this new row with the subtotal formula. It will also add grouping to the sheet so you can expand or collapse each set individually or expand/collapse all sets to a specific level at the same time.

Thanks
Author Commented:
Thanks for the suggestion Rob! I'll take a look at that as well.

- B
###### 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 Excel

From novice to tech pro — start learning today.