13

Easy Way to Add Up Expenses in Your Spreadsheets

by Yoav Ezer on March 24, 2010

Post image for Easy Way to Add Up Expenses in Your Spreadsheets

Why Have a Household Budget Spreadsheet?

One of my wife’s challenges as “manager of the household budget and head of the household purchasing committee” is to work out which purchases were justified and which should be cut down on (or argued over, whatever).

While I am a total computer addict, my wife feels she has better things to do than to spend hours in a spreadsheet working these things out. Also, if I leave it to her, she is going to say all her expenses were completely justified (how many shoes does one woman need?), and mine are all up for discussion (I am not a fast-food addict, honest!).

Here is a geeky Microsoft Excel trick that makes adding up your unnecessary expenses quick and easy. Rather than label or categorize your expenses, we can quickly run through our spreadsheet marking these expenses visually, giving both a nice clue at a glance how far off the rails our spending has gone, but also allowing us to add up these expenses with a couple of key presses!

Our Magic Color-Coded Household Budget Spreadsheet

What we decided to do is allocate a color for shoe purchases, and another color for junk food. Then we assign a macro to a keyboard combination which works out the totals to see who wins spent over budget.

Here is how an example spreadsheet might look (no, I am not showing my actual expenses, ha):

img1

Yes, yes, I know, my need for burgers ever-so slightly outweighs my wife’s shoe purchases. Perhaps I need to hack in a fail safe …

Building the Cell Color Counting Macro

Anyway, the magic is in the macro, and here it is:

First we create a little subroutine that takes our range of data and finds first the yellow (junk food), and then the red (shoes). We could make the whole thing more generic by making the range flexible but for sake of discussion it is fixed at B4:H13 right now. If you wanted more colours, just duplicate one of the lines and change the target range (eg. To K6), and the colour value (eg. To vbGreen).

Sub UpdateSalesTotals()
Range("K4").Value = SumInColor(Range("B4:H13"), vbYellow)
Range("K5").Value = SumInColor(Range("B4:H13"), vbRed)
End Sub

Next is where the real work is done, the SumInColor custom function.

Function SumInColor(rngNumbers As Range, lngColor As Long) As Currency
Dim clSpecificCell As Range
Dim lngTotal As Currency
lngTotal = 0

For Each clSpecificCell In rngNumbers
If clSpecificCell.Interior.Color = lngColor Then lngTotal = lngTotal + clSpecificCell.Value
Next

SumInColor = lngTotal
End Function

First we define our variables, then we perform a loop that goes through the supplied range (rngNumbers) looking for the supplied color (lngColor). If it finds the specified color then it adds the found figure to the running total. img2

Unfortunately, Excel does not seem to have any way we can run this macro automatically when we color a cell, so instead we must use the Options button to set a keyboard shortcut of Ctrl+Shift+C.

Magic isn’t it?

Can you think of any other ways to use or improve on this idea? Please share in the comments …

===

Yoav Ezer co-authors Codswallop, a technology and productivity blog. He is also the CEO of a software company that produces PDF to XLS conversion software.

Photo Credit: RambergMediaImages

Related Posts Plugin for WordPress, Blogger...

Get Free Email Updates

I take your privacy very seriously

About Yoav Ezer

Yoav co-authors Codswallop, a technology and productivity blog. He is also the CEO of Cogniview. For more Excel tips, join Yoav Ezer on Facebook or Twitter

  • http://www.27andfrugal.com Leslie

    The crossed out “wins” made me laugh!

  • http://www.moneyreasons.com Money Reasons

    Very nice! Excel has so much untapped power! Thanks for the excellent example!

  • http://www.zordane.com Benjie @ Zordane

    This is great stuff and just what I’ve been looking for to temporarily or even help me replace my budgeting software with. Thanks for sharing.

  • Ilan

    Made me laugh :D
    I wish there was a way to make the macro run automatically as we’re marking cells. That would make this an awesome tool.
    I especially liked the color-coding idea because it makes it all so visual, no need to think about the data too much.

  • http://www.zordane.com/colorful-excel-spreadsheet/ Making Your Excel SpreadSheet Colorful And Fun

    [...] The author’s quite an expert in excel and he shared his technique on his blog post entitled “Easy Way to Add Up Expenses in Your Spreadsheets” from couplemoney.com. He shows you how you could add colors to your list of expenses, each color [...]

  • http://www.fiscalgeek.com/2010/03/friday-round-up-get-motivated-edition/ Friday Round-Up – Get Motivated Edition

    [...] Elle presents Easy Way to Add Up Expenses in Your Spreadsheets [...]

  • http://www.debtfreeadventure.com/dfa-link-rally-america-aint-half-bad/ DFA Link Rally: Living in America Still Ain’t Half Bad Folks

    [...] Personal Finance Software ReviewMike delivers Rules for converting an RRSP to RRIFElle delivers Easy Way to Add Up Expenses in Your SpreadsheetsJunior Boomer delivers What Are Your Options With Your 401k if You Lose Your Job?Jeff Rose delivers [...]

  • http://www.four-pillars.ca/2010/03/28/carnival-of-personal-finance-blogthority-com-relaunch-edition-make-more-money-blogging/ Carnival of Personal Finance – Blogthority.com Relaunch Edition! Make More Money Blogging

    [...] from Couple Money presents Color Code & Categorize Expenses in Your Spreadsheets, and says, “One of my wife’s challenges as “manager of the household budget and head of [...]

  • http://couplemoney.com/budgeting/watch-out-for-these-common-budget-mistakes/ Watch Out For These Common Budget Mistakes — Couple Money

    [...] purchases under $5. At the end of the week, see want you spend on everything. I’d put it on a Excel spread sheet and make a pie chart and a bar chart. What’s your biggest expense? How much does it cost you? If [...]

  • http://couplemoney.com/spending/athletes-who-cant-manage-money/ How and Why Athletes Go Broke — Couple Money

    [...] carefully. Look again at your monthly budget and see how much you’re spending on things that aren’t necessary and don’t matter [...]

  • http://couplemoney.com/budgeting/10-services-to-evaluate-regularly/ 10 Potential Budget Busters — Couple Money

    [...] you got your budgeting process down pat there’s not much to it, right? Don’t rest yet, there’s more work to be [...]

  • http://www.fiscalfizzle.com/2010/03/yakezie-alexa-challenge-links/ March Links Roundup: Yakezie Challenge Edition

    [...] Money: Easy Way to Add Up Expenses in Your Spreadsheets: Elle shares an interesting technical strategy for you Excel fans out [...]

  • http://couplemoney.com/family-and-finances/couples-budget/ Strategies to Budget as a Couple

    [...] is a fact that individuals with such spreadsheets better manage their finances because it is visually compiled into an organised layout. Discipline in compiling and discussing [...]

Previous post:

Next post: