+ Reply to Thread
Results 1 to 6 of 6

If any cell in column B contains X, take number from column C in same row and add them up.

  1. #1
    Registered User
    Join Date
    10-23-2013
    Location
    Madison, WI
    MS-Off Ver
    Excel 2013
    Posts
    2

    If any cell in column B contains X, take number from column C in same row and add them up.

    Hey folks,
    I am putting together a personal expense spreadsheet and need help with this one part.

    On one sheet I have all my debits listed, date-category-price. On a second sheet I have the totals for each category for that month. Each month will have its own sheet.
    I want to take all the debits from a certain month and combine them with their respective category be shown on the given month's sheet.

    I want the equation to automatically filter out any entries outside of the target month so that I will be able to select the column as opposed to selecting the specific cells within the month.
    This will make for a more automated and "live updating" system since I wont have to change the selected cells every time I enter a new debit.

    I have attached a simple example of what I am looking for.

    Thank you so very much for you help, I really appreciate it!!!
    Attached Files Attached Files
    Last edited by BurtMacklin; 10-23-2013 at 05:35 PM.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: If any cell in column B contains X, take number from column C in same row and add them

    Try
    Please Login or Register  to view this content.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: If any cell in column B contains X, take number from column C in same row and add them

    Try something like this.

    A B C D
    1
    Category
    Month
    Total
    2
    Food cost for October
    Food
    10/1/2013
    12
    3
    Clothes cost for October
    Clothes
    10/1/2013
    5

    Worksheet Formulas
    Cell Formula
    D2 =SUMIFS(Sheet1!C:C,Sheet1!A:A,">="&C2,Sheet1!A:A,"<"&EDATE(C2,1),Sheet1!B:B,B2)
    D3 =SUMIFS(Sheet1!C:C,Sheet1!A:A,">="&C3,Sheet1!A:A,"<"&EDATE(C3,1),Sheet1!B:B,B3)

    Put a date that is the 1st of the month in column C for the month you want summed. You could set the cell formatting to display only the month if you like.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

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

    Re: If any cell in column B contains X, take number from column C in same row and add them

    Hello BurtMacklin,

    I have expanded on your posted workbook. The attached workbook contains 13 sheets: 1 for each month and a Summary.

    You only need to add the expense name to the summary sheet and drag down the row above it to update the formulas. Whenever the expense is entered, the summary sheet will reflect the change.
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  5. #5
    Registered User
    Join Date
    10-23-2013
    Location
    Madison, WI
    MS-Off Ver
    Excel 2013
    Posts
    2

    Re: If any cell in column B contains X, take number from column C in same row and add them

    It works, jindon!
    This is actually the first time I have every put any sort of code like this into excel so I had to follow an online tutorial. Nonetheless it worked perfectly on the example I provided.

    Now that I have organized my actually sheet well enough I tried putting the equation (taken from the cell of the sample sheet after I ran the macro) into my actually document.
    This is the equation I am using:
    =SUMPRODUCT((MONTH('Expense Log'!B9:B14)=10)*('Expense Log'!D9:D14="Personal Care"),'Expense Log'!E9:E14)

    However when I change each it to this:
    =SUMPRODUCT((MONTH('Expense Log'!B:B)=10)*('Expense Log'!D:D="Personal Care"),'Expense Log'!E:E)
    to include the whole column not just a selection of the column. I get #VALUE!

    Making that modification on the example sheet didn't cause any trouble at all so I am not sure what the deal is here.
    Do you know what this is happening?

    I have attached the actual document so you get a better idea of what is going on, and to answer your question yes, it is a collaboration of a couple different templates from MS

    thank you for putting up with my inexperience!

    Edit: wow didn't see the last two posts here.
    Give me a sec to look them over
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: If any cell in column B contains X, take number from column C in same row and add them

    Now your sheet is properly set, so no need of vba.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 13
    Last Post: 09-19-2013, 06:54 PM
  2. Replies: 4
    Last Post: 05-26-2013, 05:54 PM
  3. Replies: 7
    Last Post: 10-23-2012, 02:29 PM
  4. Replies: 8
    Last Post: 09-16-2012, 02:13 PM
  5. Replies: 10
    Last Post: 07-12-2010, 08:55 AM

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