# Office / Excel 2010 Formula Query

I'm having a problem with formula's on Excel. I'm not too hot on it and I only know the basics..

I've created a spreadsheet for keeping track of company purchases, on the credit card, cash, cheque, paypal, etc.

I currently only have the knowledge on the SUM() formula, however I would like to calculate the total amount spent on each payment method (Chosen in the right-hand column).

Does anyone know how I can get this to work? :-)
MINDSUPERB

If those values i.e. credit card, cash. cheque, paypal, etc. are in one column, you can use the Subtotal function.

see the link below on how to do it:

http://office.microsoft.com/en-us/excel-help/insert-subtotals-in-a-list-of-data-in-a-worksheet-HP010342620.aspx

Sincerely,
Ed
Hello,

if you could post a sample spreadsheet that shows your data layout, it would be much easier to suggest a formula or method to sum your data in your specific workbook.

There are several possibilities to sum data by category, for example a Pivot table, which can be constructed with just a few clicks and without entering any formulas, or a formula solution which could use any of these: Sumif(), Sumifs(), Sumproduct(), Subtotal().

It really depends how your data is arranged and what you want to show. So, please post a workbook with some dummy data and explain what you would want the result to look like.

cheers, teylyn
TinTombStone

Try the SumIf() function

This adds all the entries in on column that match a given entry in another column

So it the Payment types were in cells A1 to A100
And the payment ammounts were in cells B1 to B100

to sum all 'Card' Payments

=SumIf(A1:A100, "Card", B1:B100)

the second argument, Criteria, could be changed to a cell address of course

So in A110 we enter "Card", and change the formula to

=SumIf(A1:A100, A120, B1:B100)

Ingeborg Hawighorst (Microsoft MVP / EE MVE)

membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.

Still rather confused, I had a few goes but broke it superbly teylyn;

See screenshot for where I'm at :-)
Capture.JPG
Hello,

I wrote a whole raft and then EE went offline when I posted. Arghh.

Put your cursor in a cell between C3 and I15, then select Insert > Pivot table.

You will see the marching ants around your data table. Click OK to start the pivot table in a new sheet.

On the right, you will see the pivot table side panel.

Click the "Payment Method" field in the side panel and drag it to the "Row Labels" area below.

Click the "Amount Inc VAT" field in the side panel and drag it to the "Values" area below.

If the Values area field now says "Sum of Amount ...", you're done. If it says "Count of Amount ..." click the drop down arrow in the Values area, click "Value Field Settings", select "Sum" and you're done.

If that does not help, please post your workbook instead of a screenshot. I will then create the pivot table for you and will document each step with a screenshot.

cheers, teylyn

That's absolutely spot-on teylyn - and yes I've never ever seen EE go offline so for it to do it when I decide to post a question for the first time in ages, I can't help feeling someone has it in for me :o)

Now I just need to suss out how to jiggle this about a bit! I'll report back once I'm done!

quick question.. once I've applied this Pivot table to 'March' - Can I copy the formatting to another workbook easily? (I don't want to have to go through this all again on each workbook if possible).

Sorry, excel isn't my forté :-)

Just an update, this is the end result! (Trimmed company logo and a few personal details obviously!)

No idea why but it didn't upload the image properly... I think EE is a bit broke today!
Capture.JPG
Hello,

glad to see you got this sussed.

>> Can I copy the formatting to another workbook easily?

I see you have a separate sheet for each month. With this, you can create a pivot table in each sheet. Alternatively, you can have ALL data in just one sheet, and then adjust your pivot table to include the date. Pull the date into the Row Labels area, and put it above the Payment Method field. The date will be added to the pivot table. Right click any of these dates, then select Group ... and in the next dialog select Year and Month.

Now you can use the drop-downs at the top of the date column to look at just one month, or you can see an overview sorted by month.

cheers, teylyn

Nearly there! For some reason there's also a (blank) field shown - Can I hide this?

Thanks!
Hello,

check the source data for the Pivot table. If you have selected more rows than you have data, you will see the (Blank). You will also see the (Blank) if a data field in the source table does not have any content.

So, make sure to include only populated rows of the data table and make sure that all your data fields have been filled in.

You can make your Pivot table data source dynamic by creating a dynamic range name and pointing the pivot source to that range name. A tutorial for that is on the Contextures website http://www.contextures.com/xlPivot01.html

cheers, teylyn