+ Reply to Thread
Results 1 to 13 of 13

Data summation with multiple conditions

  1. #1
    Registered User
    Join Date
    06-01-2015
    Location
    Chicago,Illinois
    MS-Off Ver
    2013
    Posts
    6

    Data summation with multiple conditions

    Hi all, hope I can get some help here.

    I am trying to create a rolling balance for an account assuming known Weekly and Monthly expenses. For the weekly expenses, I would know which day of the week it would occur (1-7) and for the monthly expenses I would know which day of the month it would occur (1-31). I would start with the current date using TODAY() and add consecutive dates for the next 180 days. I would then like excel to look at all the expenses, look at a field that calls the expense out as weekly or monthly, then look at the date in the data table, and determine if today is one of those days (using WEEKDAY() and DAY()). I could then see this for the next 180 days to get a good estimate of what the Account balance should look like.

    I can get everything to work expect for excel knowing how to distinguish between weekly or monthly expenses. I have tried playing around with SUMIF, DSUM, and SUMPRODUCT but I can't get that final piece to work. Below is a simplified version of what I am envisioning this looking like.

    Capture.JPG

    The SUMIF I currently have in cell C4 is: =SUMIF($G$4:$G$8,WEEKDAY(A4),$H$4:$H$8)
    The formula for C5 reads =SUMIF($G$4:$G$8,WEEKDAY(A5),$H$4:$H$8), etc, etc.

    The SUMIF I currently have in cell D4 is: =SUMIF($G$4:$G$8,DAY(A4),$H$4:$H$8)
    The formula for D5 reads =SUMIF($G$4:$G$8,DAY(A5),$H$4:$H$8)

    Right now it can't recognize if it's a weekly or monthly expense. If it could, based on the Data Table, the only value that should be in column D is the $50 at cell D16.

    Any idea on how to do this? I think DSUM might be what I need but I can't figure out how to do variable criteria to deal with the constantly changing date.

    I have attached this sample excel file if you would like to play around with it.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: Data summation with multiple conditions

    The formula in D4 should be:
    Please Login or Register  to view this content.
    Because you don't want to add monthly items to your weekly list.

    The formula in E4 should be:
    Please Login or Register  to view this content.
    Some people volunteer in soup kitchens or hospitals. I choose to make the world better by trying to help you with Excel. We're all learning.

    <---Click * Add Reputation for all helpful comments. It's like giving a smile.
    Forum Rules: How to mark your post [Solved] and have a happier, Excel enriched life.

  3. #3
    Registered User
    Join Date
    06-01-2015
    Location
    Chicago,Illinois
    MS-Off Ver
    2013
    Posts
    6

    Re: Data summation with multiple conditions

    Thanks for the help! Didn't know about SUMIFS

  4. #4
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: Data summation with multiple conditions

    Glad it works. SUMIFS opens up a whole new world.

  5. #5
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: Data summation with multiple conditions

    You could also use sumproduct like this just for your own learning. It also opens up a lot of possibilities for multiple filters.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-01-2015
    Location
    Chicago,Illinois
    MS-Off Ver
    2013
    Posts
    6

    Re: Data summation with multiple conditions

    So this works great for weekly and monthly and I thought I could figure out how to use this for Bi-weekly (every 14 days) but I seem to be stumped again .

    Let's assume instead of weekly, I replace that with Bi-weekly. I thought the equation would just be =SUMIFS($I$4:$I$8,H$4:$H$8,MOD($B4,14),$L$4:$L$8,"Bi-Weekly"). Obviously I am missing something because it just returns $0. Thoughts on what is wrong?

  7. #7
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: Data summation with multiple conditions

    B4 just gives you a long number. If you put in Day(B4) it should work better.

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    06-01-2015
    Location
    Chicago,Illinois
    MS-Off Ver
    2013
    Posts
    6

    Re: Data summation with multiple conditions

    Still no dice. DAY() returns the day of the month, which isn't what I would want in this situation, correct?

    Some more background, I was previously using this formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    (modified to make sense with the above cells). This only works though when it is identifying one specific cell, not a range like the above SUMIFS do. I would like to apply what you helped me with earlier except now using the BI-WEEKLY as another option.

    Thanks for all your help.

  9. #9
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: Data summation with multiple conditions

    This works as I would imagine it should. The best way to do bi-weekly is to take the date and do the mod function with a 14 day period.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    06-01-2015
    Location
    Chicago,Illinois
    MS-Off Ver
    2013
    Posts
    6

    Re: Data summation with multiple conditions

    Because of how DAY() works, it looses count of the 14 days every time a new month starts. I would need this to be accurate for 180 days. If you can't call out a full date (day/month/year) this won't work. You can see what I mean if, using your attached spreadsheet, you make a bi-weekly entry and input "1" under the "Date" column, you will get an entry on 6/29 and then again 7/1 (2 days later, not 14). Below is an image of this.
    Capture.JPG

  11. #11
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: Data summation with multiple conditions

    I see the problem. I think this fixes it. The problem is that Bi-weekly needs a better start date. For weekly you can just enter the day of the week you want the amount to appear (1-7). For monthly you can out the day of the month you want it to appear (although I am not sure how to handle the case where someone puts the 31st and there is no 31st in a given month). Bi-Weekly cannot just be based on the day of the week or the day in the month, because once it is started, it is independent of the day of the month or week. It is only dependent on being 2 weeks after the previous appearance. So I made it date based. I know that may not be ideal for your example, but it is the only thing I can think of that works.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    06-01-2015
    Location
    Chicago,Illinois
    MS-Off Ver
    2013
    Posts
    6

    Re: Data summation with multiple conditions

    This is exactly what I wanted. It looks like it works so far so I should be set. Thanks for the help!

  13. #13
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: Data summation with multiple conditions

    You are welcome. I'm glad it is working.

+ 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. Excel Summation Query from IF conditions
    By jasonandmary in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-02-2014, 08:24 PM
  2. Replies: 7
    Last Post: 04-18-2010, 07:43 PM
  3. How to do summation with 2 conditions?
    By Lewis Koh in forum Excel General
    Replies: 3
    Last Post: 04-18-2010, 11:17 AM
  4. How to do summation with 2 conditions?
    By Lewis Koh in forum Excel General
    Replies: 2
    Last Post: 04-18-2010, 11:16 AM

Tags for this Thread

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