Results 1 to 3 of 3

Thread: SUM of various expenses per month

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2004
    Posts
    11

    SUM of various expenses per month

    NOTE TO ADMIN: I originally posted this in the "Classic Visual Basic" Forum and was advised to include it here. I tried to delete it but wasn't allowed. I have nothing against you deleting it where appropriate. Thankyou.

    I have a worksheet where column A is the date (in format 01-Jan-2004), column C is the amount spent and column D is what is was spent on.

    I would like to find out how much was spent on food each month, how much on travel etc. So I need to be able to say

    Where column A = November 2004 AND column D = "Food" SUM all numbers in column C

    But I'm a novice at Excel. Would this best be done by writing a function in visual basic or is there a quicker way to do it?

    Thanks for any help

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: SUM of various expenses per month

    'sumif' I think will be the function you want.

    You could do a pivot to get all the distinct (unique) types then sumif to get totals.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: SUM of various expenses per month

    Yes, SUMIF is the correct function for this. I have made a small ex. for you in case you havent solved it yet.
    Code:
    1-Jan-04		25	Food
    1-Jan-04		50	Food
    1-Jan-04		25	Stuff
    1-Jan-04		100	Food
    1-Jan-04		75	Stuff
    1-Feb-04		150	Food
    1-Feb-04		200	Stuff
    1-Feb-04		25	Food
    1-Feb-04		50	Stuff
    1-Mar-04		100	Food
    1-Mar-04		275	Stuff
    1-Mar-04		25	Food
    1-Mar-04		25	Food
    --------------------------------
                            500
    
    =SUMIF(D1:D13,"Food",C1:C13)
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width