+ Reply to Thread
Results 1 to 9 of 9

Summing expenses based on month & Vlookup

  1. #1
    Registered User
    Join Date
    05-28-2008
    Posts
    13

    Summing expenses based on month & Vlookup

    Hi Guys,

    I'm having a bit of an issue.

    I want to be able to sum expenses for the year-to-date ie. If I want the sum for the expense item to March, I want to be able to type in March and it sums up the expense up until March.

    The other issue is that I want to combine a "vlookup" type entry into this formula. I want it to look for the specific expense and then sum up the expense up until any desired month.

    The reason for this is that the expense is situated on different rows in the different worksheets.

    Is this at all possible - I hope I've explained myself correctly...

    Please help.

    Thanks

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Hi,

    May be SUMPRODUCT would be better, take a look here

    http://www.excelforum.com/showthread.php?t=645506
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Registered User
    Join Date
    05-28-2008
    Posts
    13
    Thanks oldchippy,

    I'm still having an issue.
    For ease of explanation, I've attached a file with some data.

    You'll see that I have no problem when collecting the data from each company for the month of march (simple vlookup)

    The problem is in the Year to Date(YTD) calculation.
    With only 3 companies to manage, I could use the sum,offset and match but this is assuming I know exactly where the expense is situated in each row. You may think I'm being lazy here with only 3 companies, but the reality is that are more than 140, and that is a bit much.

    I want the formula to locate the expense in any row in column A, and then sum the monthly expense up until the month selected from the drop-down list.
    Am I asking too much?
    I should then be able to edit the formula to change just the sheet that I need the data from.

    Please help...
    Oh, and thanks in advance....
    Attached Files Attached Files

  4. #4
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Hi,

    Could you save it in 2003 format only I'm not on my usual PC

  5. #5
    Registered User
    Join Date
    05-28-2008
    Posts
    13
    No Probs,

    Here it is...
    Attached Files Attached Files

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello antonc,

    The attached workbook contains 2 the User Defined Functions YTD and YTD_All. The code for these macros appears below. YTD takes 3 arguments: Expense to search for, the eding month as a number, and the Name of the Worksheet to search.
    YTD_All takes only 2 arguments: The Expense, and the ending month as a number.

    Example
    Please Login or Register  to view this content.
    UDF Macro Code
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    06-04-2008
    Posts
    10

    Pivot tables are wonderful

    Often we enter what is really data into format that is a semi report format.

    If we treat data as data you can then use a pivottable, they are very powerful and really easy to use.

    See attached
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    05-28-2008
    Posts
    13
    Thanks for the replies.

    The YTD_All works perfectly, but I'm not comfortable with macros (ie don't have a clue how to adapt them to my situation). I'll work with what you've given me and go through it step-by-step.

    The pivot table is also useful, but that involves the manipulation of the data into a structure. I'm guessing that would be too time consuming.

    Thanks again guys - appreciate it.

  9. #9
    Registered User
    Join Date
    06-04-2008
    Posts
    10

    Smile 140 companies mmmmmmmmm

    I'd be investing the time to set up the data so you can use pivottables.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1