+ Reply to Thread
Results 1 to 28 of 28

How to sum cells based off of a date range

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-02-2013
    Location
    West Palm beach, Fl
    MS-Off Ver
    Excel 2010
    Posts
    113

    How to sum cells based off of a date range

    Hello!

    I have two concerns that need solutions based off of the same problem. I attached a sample workbook. On my data sheet I need to count specific information from the worksheets labeled from January to December 2013. For instance, lets say I need the total completed discharges for March 2013. I thought it was as simple as counting all of the cells with "complete" in them under the TOD column on each respective sheet (countif). Unfortunetly the "completes" for March are based off of the DOD column (date of discharge), which means just because it says "complete" in that month, does not mean the client actually completed treatment in that month. YIKES! So, i need to be able to count specific criteria for each month based off of a date range that spreads across 12 sheets of data. Is that possible? My next concern is how to figure out the LOS (length of Stay) for each TOD (type of discharge) for each month. That is calculated by the difference between the DOA column (date of arrival) and the DOD column. Once again, i thought it was an easy solution, but ran into the same problem above. Any help would be greatly appreciated! Thanks in advance!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: How to sum cells based off of a date range

    Hello Nicki what is the criteria for complete in a month?
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    WANT TO SAY THANKS, HIT ADD REPUTATION (*) AT THE BOTTOM LEFT CORNER OF THE POST

    More we learn about excel, more it shows us, how less we know about it.

    for chemistry
    https://www.youtube.com/c/chemistrybyshivaansh

  3. #3
    Forum Contributor
    Join Date
    04-02-2013
    Location
    West Palm beach, Fl
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: How to sum cells based off of a date range

    Hi hemesh,

    the type of discharge is determined by how a client leaves our facility, and is not relavent to what I am looking for. However, the client recieves a type of discharge (complete, AMA, medical, etc) when they leave our facility. The date that they leave is how I need to count each type of discharge for each month. It's called the DOD (date of discharge) if the DOD is 5/25/13 and the TOD is Complete, then it should be counted in the May slot under Complete. does that make sense?

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: How to sum cells based off of a date range

    Looking at your data, is there a reason you have each month on its own sheet? I think a lot of your problems would resolve themselves if you had all your data on 1 sheet. Then it wouldnt matter which "month sheet" the data was on, you could set up the countifS() to look at the DOD data
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Forum Contributor
    Join Date
    04-02-2013
    Location
    West Palm beach, Fl
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: How to sum cells based off of a date range

    FDibbins,

    I would love to, unfortunetely this is sample data from a very large treatment census for a hospital, and that is how they decided to keep track of their admissions. They want to track other information from this data, and I am the one tasked with this monster! Thanks for your help anyway!

  6. #6
    Forum Contributor
    Join Date
    04-02-2013
    Location
    West Palm beach, Fl
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: How to sum cells based off of a date range

    So,

    If i could somehow get all of the information onto one sheet, I would then be able to match the DOD with the TOD and collect my data for each month that way? How would the formula look then? :-)

  7. #7
    Forum Contributor
    Join Date
    04-02-2013
    Location
    West Palm beach, Fl
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: How to sum cells based off of a date range

    Unless the array formula that hemesh so graciously provided can be modified to work across multiple sheeets?

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: How to sum cells based off of a date range

    for counting with multiple criteria, take a look at using the counitifS() function

    edit: sorry that wont work across multiple sheets
    Last edited by FDibbins; 10-15-2013 at 02:47 PM.

  9. #9
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: How to sum cells based off of a date range

    As you have already counted LOS in the last column of each sheet by datedif() function and now you need to add them so you can try below in B13 then drag down
    =SUMIF('January 2013'!$L$3:$L$50,'Data Sheet'!A3,'January 2013'!$P$3:$P$50)

  10. #10
    Forum Contributor
    Join Date
    04-02-2013
    Location
    West Palm beach, Fl
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: How to sum cells based off of a date range

    hemesh,

    thanks for your quick responses. However, I tried something like that already. It works great if it was just a simple match and count issue, but the LOS for "complete" for January is based off of the DOD (date of discharge). Many clients may be admitted in January, but discharged in a different month. Which makes the problem much more challenging, becuase now I need to search for "complete" in a date range through multiple sheets, and somehow sum them on my data sheet under the respective cell. Better clarification?

  11. #11
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: How to sum cells based off of a date range

    here is a little trick for the top table so you dont have to keep referring to the sheet name....
    =COUNTIF(INDIRECT("'"&TEXT(A$1,"mmmm yyyy")&"'!$L$3:$L$50"),A2)

  12. #12
    Forum Contributor
    Join Date
    04-02-2013
    Location
    West Palm beach, Fl
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: How to sum cells based off of a date range

    FDibbins,

    Thank you for the neat trick! It may be very helpful in the future. Unfortuntely for me, at the moment it doesn't quite do the trick. For instance, in the February sheet, some of the "complete" may have a DOD (date of discharge) of a different month, and therefore need to be counted in their respective month, not February. Blah

  13. #13
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: How to sum cells based off of a date range

    nicki try this in data sheet B2
    =SUM(--('January 2013'!$L$3:$L$50='Data Sheet'!A2)*(MONTH('January 2013'!$I$3:$I$50)=1)) copy paste and instead of pressing control and enter
    hold control and shift and then hit enter to make it array formula

    this formula count complete and DOD in january month only

    Or the simple formula works with control and enter is
    SUMPRODUCT(--('January 2013'!$L$3:$L$50='Data Sheet'!A2)*(MONTH('January 2013'!$I$3:$I$50)=1))
    you need to change 1 to 2 for february 3 for march and so on

    Now for other months like February and so on you can combine the trick provided by FDibbins Sir.
    Last edited by hemesh; 10-15-2013 at 03:15 PM.

  14. #14
    Forum Contributor
    Join Date
    04-02-2013
    Location
    West Palm beach, Fl
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: How to sum cells based off of a date range

    hemesh,

    That works great for January! Unfortunetly, the DOD's that happen in other months on the January Sheet will now be unaccounted for going forward. I don't suppose there is a way to use that array formula over multiple sheets? Maybe this is a lost cause? lol

  15. #15
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: How to sum cells based off of a date range

    Hello Nicki as Mr.Fdibbins said you should copy paste all date on new sheet like you can create data dump sheet and copy paste all data there then reference all formulas in that sheet and hide that sheet. It would a lot comfortable and easier to get the result you moreover you will not be manipulating the data you which is used by other people
    then with formula like

    SUMPRODUCT(--('Data Dump'!$L$3:$L$13000='Data Sheet'!A2)*(MONTH('Data Dump'!$I$3:$I$13000)=1))

    you can get the result

  16. #16
    Forum Contributor
    Join Date
    04-02-2013
    Location
    West Palm beach, Fl
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: How to sum cells based off of a date range

    hemesh,

    THanks, I think I will actually give that a shot! I appreciate your help! It looks like it will work just fine under those conditions! Thank you again!

  17. #17
    Forum Contributor
    Join Date
    04-02-2013
    Location
    West Palm beach, Fl
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: How to sum cells based off of a date range

    Last question,

    With the data dump sheet in place, your formula works for January, but how do I get it to work for the other months? Thanks!

  18. #18
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: How to sum cells based off of a date range

    This is what I am working on so far. I know its cumbersome, and still has a way to go...
    Attached Files Attached Files

  19. #19
    Forum Contributor
    Join Date
    04-02-2013
    Location
    West Palm beach, Fl
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: How to sum cells based off of a date range

    FDibbins,

    That could be the solution to working with multiple sheets. i could just hide all of the excess data. One thing I noticed is that the formula is counting feb 1st as part of January, but otherwise it looks great!

  20. #20
    Forum Contributor
    Join Date
    04-02-2013
    Location
    West Palm beach, Fl
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: How to sum cells based off of a date range

    Actually, by taking out the second = sign, it remedies that issue! Thanks!

  21. #21
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: How to sum cells based off of a date range

    Quote Originally Posted by FDibbins View Post
    This is what I am working on so far. I know its cumbersome, and still has a way to go...
    THis isnt going to help much after all It still has the potential problem of grabbing multiple months of data from each moth sheet

  22. #22
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,355

    Re: How to sum cells based off of a date range

    Hi,

    I agree that having all your data on a single sheet would help solve the problem. I'd use Pivot Tables with filters if it were on a single sheet. I'd also group by date. It would be pretty easy.

    Excel has an Add-In tool called PowerPivots that was built for problems like this. Find it free for 2010 and better versions of Excel at:
    http://www.microsoft.com/en-us/bi/powerpivot.aspx

    The idea is you add ranges from all your sheets into a single pivot table and you can solve the problem...

    Hope this helps.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  23. #23
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: How to sum cells based off of a date range

    Hello Nicki, What I was trying to do is attached and I hope this solves the purpose.Now Working on second part of the sheet
    Attached Files Attached Files

  24. #24
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: How to sum cells based off of a date range

    Are you looking something like this?

    I have created a data dump sheet and a new setup sheet where you need write formula once and just drag top to bottom and left to right.
    (Reference from data sheet is up to 3000 rows which you can change in case it increases)

    Hope this helps
    Attached Files Attached Files

  25. #25
    Forum Contributor
    Join Date
    04-02-2013
    Location
    West Palm beach, Fl
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: How to sum cells based off of a date range

    hemesh,

    That's works wonderfully! I really appreciate your help. I really appreciate everyone's help! I have learned a lot in the process. Thanks again everyone!

  26. #26
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,941

    Re: How to sum cells based off of a date range

    Can you prepare it manually for 2 months with less data and upload the file

  27. #27
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: How to sum cells based off of a date range

    You are welcome Nicki

  28. #28
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: How to sum cells based off of a date range

    Happy to help and Im glad you got your question resolved Thanks for the feedback

+ 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. [SOLVED] Formatting a range of cells based on a date
    By john dalton in forum Excel General
    Replies: 4
    Last Post: 09-06-2013, 10:41 AM
  2. [SOLVED] Add up cells based on text within a date range
    By Munkle555 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-02-2013, 09:06 AM
  3. [SOLVED] concat cells based on date range
    By DamianWarS in forum Excel General
    Replies: 8
    Last Post: 09-14-2012, 12:39 PM
  4. SOS: Find Date Range based on value in cells
    By SandeepYadav in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-28-2012, 08:02 AM
  5. Count cells based on date range
    By The_Oakster in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-14-2009, 06:24 PM

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