+ Reply to Thread
Results 1 to 39 of 39

count depend on month range

  1. #1
    Registered User
    Join Date
    11-13-2019
    Location
    KSA, Riyadh
    MS-Off Ver
    Windows 10
    Posts
    29

    Arrow count depend on month range

    Hi,

    I have question,

    I want count number of patient depend on admission and discharge date, also count total days on the same month


    here is an example it should count number of patient in specific month even the patient extent to next month will count one in next month.

    So I need how to count Total Patient and Total days based on month period.


    thanks a lot



    please see attachment
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by banda; 06-12-2020 at 08:35 PM. Reason: link

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,885

    Re: count between 2 columns depend on month range

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not provided the required cross-post link(s) here.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    (Note: this requirement is not optional. No help to be offered until the link is provided.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    11-13-2019
    Location
    KSA, Riyadh
    MS-Off Ver
    Windows 10
    Posts
    29

    Re: count between 2 columns depend on month range

    Quote Originally Posted by alansidman View Post
    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not provided the required cross-post link(s) here.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    (Note: this requirement is not optional. No help to be offered until the link is provided.)



    Hi Alan,

    I,m not familiar to this, please help me.





    thanks

    banda

  4. #4
    Forum Contributor
    Join Date
    04-15-2013
    Location
    Singapore, Melbourne
    MS-Off Ver
    Office 365
    Posts
    167

    Re: count depend on month range

    It is a good question. But it is too difficult to solve this problem with formula. It will be much easier if you use code.
    Row row row your boat
    Gently down the stream

  5. #5
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: count depend on month range

    Have you cross-posted somewhere, i.e, mrexcel.com or others website?
    to avoid wasting time for every one, pls provide the link.
    I have got solution already, but I cant post at the moment.
    Quang PT

  6. #6
    Registered User
    Join Date
    11-13-2019
    Location
    KSA, Riyadh
    MS-Off Ver
    Windows 10
    Posts
    29

    Re: count depend on month range

    Quote Originally Posted by Metoo7 View Post
    It is a good question. But it is too difficult to solve this problem with formula. It will be much easier if you use code.
    Thanks yes agree with you it is smart question and I think this site is the best expert.

  7. #7
    Registered User
    Join Date
    11-13-2019
    Location
    KSA, Riyadh
    MS-Off Ver
    Windows 10
    Posts
    29

    Re: count depend on month range

    Quote Originally Posted by bebo021999 View Post
    Have you cross-posted somewhere, i.e, mrexcel.com or others website?
    to avoid wasting time for every one, pls provide the link.
    I have got solution already, but I cant post at the moment.


    Thanks Mr.Bebo,

    I will post it in Mrexcel.com.

    is it allow to post the link here?

    I want to follow the rule of the best excel forum ever.

    I need solution if you can.


    thanks a lot again

  8. #8
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: count depend on month range

    Quote Originally Posted by banda View Post
    I will post it in Mrexcel.com.
    is it allow to post the link here?
    Nooo, you are misunderstanding me
    see this:

    3. Questions that are cross-posted to other web forums must contain links to those posts on those forums or a comment to tell us where else the question has been asked. (A, Z*)

  9. #9
    Registered User
    Join Date
    11-13-2019
    Location
    KSA, Riyadh
    MS-Off Ver
    Windows 10
    Posts
    29

    Re: count depend on month range

    Quote Originally Posted by bebo021999 View Post
    Nooo, you are misunderstanding me
    see this:
    so it is OK to post the link here?

  10. #10
    Registered User
    Join Date
    11-13-2019
    Location
    KSA, Riyadh
    MS-Off Ver
    Windows 10
    Posts
    29

    Re: count depend on month range

    Hi again,

    I post it in Mrexcel.com

    https://www.mrexcel.com/board/thread...range.1137099/


    Thanks again

  11. #11
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: count depend on month range

    Quote Originally Posted by banda View Post
    so it is OK to post the link here?
    Sure. That is all we need before keep going

  12. #12
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: count depend on month range

    So it seems you have solution of counting #patients
    For Total days, apply this formula in P7:
    Please Login or Register  to view this content.
    **Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    11-13-2019
    Location
    KSA, Riyadh
    MS-Off Ver
    Windows 10
    Posts
    29

    Re: count depend on month range

    Quote Originally Posted by bebo021999 View Post
    So it seems you have solution of counting #patients
    For Total days, apply this formula in P7:
    Please Login or Register  to view this content.
    **Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
    it not solved my dear because on Jan we have 4 patient and each patient stay at hospital 31 days in Jan 2020 so the total should be accurate.

    Thanks my friend can you try again

  14. #14
    Registered User
    Join Date
    11-13-2019
    Location
    KSA, Riyadh
    MS-Off Ver
    Windows 10
    Posts
    29

    Re: count depend on month range

    Quote Originally Posted by bebo021999 View Post
    So it seems you have solution of counting #patients
    For Total days, apply this formula in P7:
    Please Login or Register  to view this content.
    **Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
    I forgot to tell you even total # of patient is not solved I put example to see the number I expect in the column O based on the month

  15. #15
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: count depend on month range

    Base on your calculation in L7, full days of Jan is 30 days.
    My current formula returns 120 days for Jan (4*30)
    If Jan days to be 31 days, try again:
    Please Login or Register  to view this content.
    return 124 days (31*4)

  16. #16
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,885

    Re: count depend on month range

    @banda

    Do not quote whole responses of others. It is only clutter. Click on Reply -- Do not click on Reply with Quote especially if you are only responding to one other person. They know what they have posted. You do not need to tell them.

  17. #17
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,885

    Re: count depend on month range

    You have been advised about crossposting here and at MrE, yet you have ignored this rule and posted at Chandoo. I urge you to re-read all the forum rules you agreed to when you joined. Future failures in this area may result in your banishment from this forum for a period of time. Don't let this happen.

    Please address that crosspost with a link.

    No further help to be offered this OP until compliance with this forum's rules.
    Last edited by alansidman; 06-12-2020 at 10:49 PM.

  18. #18
    Registered User
    Join Date
    11-13-2019
    Location
    KSA, Riyadh
    MS-Off Ver
    Windows 10
    Posts
    29

    Re: count depend on month range

    Good morning,

    sorry I forgot it while busy in the hospital with COVID19.

    Hope you understand our situation to have correct statistics.

    yes I post it in Chanddoo too

    https://chandoo.org/forum/threads/co...h-range.44470/

  19. #19
    Registered User
    Join Date
    11-13-2019
    Location
    KSA, Riyadh
    MS-Off Ver
    Windows 10
    Posts
    29

    Re: count depend on month range


  20. #20
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: count depend on month range

    Quote Originally Posted by banda View Post
    I forgot to tell you even total # of patient is not solved I put example to see the number I expect in the column O based on the month
    In O7:
    Please Login or Register  to view this content.

  21. #21
    Registered User
    Join Date
    11-13-2019
    Location
    KSA, Riyadh
    MS-Off Ver
    Windows 10
    Posts
    29

    Re: count depend on month range

    O7 give me correct answer, thank you very very much.

    what about total days per month for all patients together.

    sorry I gave you hard time

  22. #22
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: count depend on month range

    Does the formula in #15 work?

  23. #23
    Registered User
    Join Date
    11-13-2019
    Location
    KSA, Riyadh
    MS-Off Ver
    Windows 10
    Posts
    29

    Re: count depend on month range

    it dose not work sir

    I want to give me sum for all days each month for every patient

    see the exact pict last one in green color.
    Attached Images Attached Images

  24. #24
    Forum Contributor
    Join Date
    04-15-2013
    Location
    Singapore, Melbourne
    MS-Off Ver
    Office 365
    Posts
    167

    Re: count depend on month range

    How about Admission in the morning and discharge in the afternoon?

  25. #25
    Registered User
    Join Date
    11-13-2019
    Location
    KSA, Riyadh
    MS-Off Ver
    Windows 10
    Posts
    29

    Re: count depend on month range

    it count one also

  26. #26
    Forum Contributor
    Join Date
    04-15-2013
    Location
    Singapore, Melbourne
    MS-Off Ver
    Office 365
    Posts
    167

    Re: count depend on month range

    It would much more easier if you redesign your spreadsheet like this:

    360截图1683110774117103.png

    M7 formula:
    Please Login or Register  to view this content.
    For those patients discharged in the same day of admission, count as one day.
    In this case, for row 12 in my screenshot, should it be counted as one day or two days?
    Last edited by Metoo7; 06-13-2020 at 12:20 AM.

  27. #27
    Registered User
    Join Date
    11-13-2019
    Location
    KSA, Riyadh
    MS-Off Ver
    Windows 10
    Posts
    29

    Re: count depend on month range

    can you send the excel sheet to me .... I will do it

  28. #28
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: count depend on month range

    Quote Originally Posted by banda View Post
    it dose not work sir
    Have you confirmed with Ctrl-shift-enter?

    Capture.PNG

  29. #29
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,910

    Re: count depend on month range

    Or try UDF:
    Please Login or Register  to view this content.
    Using:

    =CountDayOftMoth($H$7:$H$100,$J$7:$J$100,N7)

  30. #30
    Forum Contributor
    Join Date
    04-15-2013
    Location
    Singapore, Melbourne
    MS-Off Ver
    Office 365
    Posts
    167

    Re: count depend on month range

    stay safe and take care of yourself~
    Attached Files Attached Files

  31. #31
    Registered User
    Join Date
    11-13-2019
    Location
    KSA, Riyadh
    MS-Off Ver
    Windows 10
    Posts
    29

    Re: count depend on month range

    yes I confirm ctrl **** enter and give diffrent number
    Attached Images Attached Images

  32. #32
    Registered User
    Join Date
    11-13-2019
    Location
    KSA, Riyadh
    MS-Off Ver
    Windows 10
    Posts
    29

    Re: count depend on month range

    sir Metoo,

    it not like this becuase I want to have sum of total days for all patient in Jan 2020.

    for exampl

    Patient A - stay in hospital 20 days from 1 Jan to 20 Jan 2020 = 20 days in Jan 2020
    Patient B stay from 1 Jan 2020 to 3 Feb 2020 = 31 Day in Jan and 3 days in Feb 2020
    Patient C stay from 1 Feb 2020 to 15 Feb 2020 = 15 Days in Feb

    so the total days should like this:

    Jan 2020 = 20 + 31 = 51 day
    Feb 2020 = 3 + 15 = 18 day


    and so on

  33. #33
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: count depend on month range

    Quote Originally Posted by banda View Post
    yes I confirm ctrl **** enter and give diffrent number
    Pls re-caculate again due to last 2 dates in Admission changed.

  34. #34
    Registered User
    Join Date
    11-13-2019
    Location
    KSA, Riyadh
    MS-Off Ver
    Windows 10
    Posts
    29

    Re: count depend on month range

    I tried sir bebo

    can you do it in excel and upload it

    I'm very sorry to give you hard time

  35. #35
    Forum Contributor
    Join Date
    04-15-2013
    Location
    Singapore, Melbourne
    MS-Off Ver
    Office 365
    Posts
    167

    Re: count depend on month range

    refer to your request and my reply in above Level #30.

    Please Login or Register  to view this content.
    The result of my calculation is exactly the same as the result requested in your example See below last 3 records in red in my screenshot example.

    adf.png
    Last edited by Metoo7; 06-13-2020 at 12:49 AM.

  36. #36
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: count depend on month range

    My results base on below manual calculation for each row:
    Jan: 31+31+31+28 = 121
    Feb: 0+3+29+25+3=60
    Mar:0+0+3+10=13

    How your expect to be 124,64,16

  37. #37
    Registered User
    Join Date
    11-13-2019
    Location
    KSA, Riyadh
    MS-Off Ver
    Windows 10
    Posts
    29

    Re: count depend on month range

    Sir Bebo

    You are absolutely right, I'm wrong.

    I'm not expert in excel, I'm Doctor but I love excel because it help me.

    You solve my issue and thank you very much Sir Bebo you are amazing.

    Thanks to all member her in this wonderful forum.

    Band

  38. #38
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: count depend on month range

    Make sure you share this solution on all the other forums where you asked the same question.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  39. #39
    Registered User
    Join Date
    11-13-2019
    Location
    KSA, Riyadh
    MS-Off Ver
    Windows 10
    Posts
    29

    Re: count depend on month range

    sure I will share it now

    Thanks and my appreciation to all

+ 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] How to fill range od cell with color depend of value
    By KertLopper in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-02-2020, 05:37 AM
  2. Replies: 3
    Last Post: 08-10-2018, 04:38 PM
  3. How to add new sheet and name depend on range of cells?
    By haitham.shop in forum Excel General
    Replies: 12
    Last Post: 06-08-2017, 05:29 PM
  4. How to add new sheet and name depend on range of cells?
    By haitham.shop in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-07-2017, 04:56 PM
  5. [SOLVED] Two Columns that depend on each other?
    By ntokar in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-20-2016, 12:29 PM
  6. [SOLVED] Need if formulas no need to depend on helper columns
    By jackson_hollon in forum Excel Formulas & Functions
    Replies: 24
    Last Post: 07-24-2016, 04:07 PM
  7. hide cells depend by amount days in month
    By eugz in forum Excel General
    Replies: 2
    Last Post: 12-18-2009, 03:54 PM

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