+ Reply to Thread
Results 1 to 5 of 5

function that will sum the total length of stay

  1. #1
    Registered User
    Join Date
    05-16-2019
    Location
    Scotland
    MS-Off Ver
    2007
    Posts
    2

    function that will sum the total length of stay

    Morning.

    I'm trying to create a function that will sum the total length of stay for a person in a given hospital ward. I've tried various iterations of sumif, sumifs, etc, but I can't seem to get it to work. In cell AA, I want to sum total length of stay for ICU, of which there was only one. However if "5th" (T4:V4) was also ICU, i'd want that to be summed into the total that will appear in AA, if that makes sense?

    Any worldly individuals out there that can see how to overcome this?

    Thanks a million for your help in advace

    blendypops

    Attachment 624620
    Attached Files Attached Files
    Last edited by blendypops; 05-16-2019 at 03:25 AM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,640

    Re: sumifs, but maybe not?

    Hi and welcome
    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,790

    Re: function that will sum the total length of stay

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however the thread title does not really convey what your request is about.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. You are new here, so I've done it for you this time.)
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  4. #4
    Registered User
    Join Date
    09-15-2011
    Location
    Toronto, Canada
    MS-Off Ver
    Microsoft 365
    Posts
    6

    Re: function that will sum the total length of stay

    This post still open so I assume there's no answer yet.
    The following formula for cell AA4 seems to work

    =SUM(IF($H4=AA$3,$J4,0),IF($K4=AA$3,$M4,0),IF($N4=AA$3,$P4,0),IF($Q4=AA$3,$S4,0),IF($T4=AA$3,$V4,0),IF($W4=AA$3,$Y4,0))

    The basic idea is that each IF function (there are 6 of them) returns either the length of stay or 0. We take the sum of 6 numbers and that's the solution of "ICU" (actually AA$3)

    I've put $ at the "right" places so that the formula can be copied across to give the right answer for NSD, 3E, etc. And it can be copied down to compute for other rows.

    I'm sure this could be simplified but I haven't worked on it further. Seems to be straightforward and works for the spreadsheet you provided.

    Hope this helps.

  5. #5
    Registered User
    Join Date
    05-16-2019
    Location
    Scotland
    MS-Off Ver
    2007
    Posts
    2

    Re: function that will sum the total length of stay

    I can't lie, this spreadsheet hasn't been used in about a year. However, thank you so much for your answer, the function works well and I will definitely be using it in other projects going forward. Thanks a million
    Last edited by AliGW; 10-14-2020 at 09:22 AM. Reason: PLEASE don't quote unnecessarily!

+ 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: 0
    Last Post: 08-22-2017, 03:49 PM
  2. [SOLVED] Sumifs formula without using sumifs....
    By blockbyblock in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-10-2017, 10:45 AM
  3. [SOLVED] If no SUMIFS matches, 1, otherwise the SUMIFS result...
    By JYTS in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-04-2016, 07:39 PM
  4. sumifs vs. Application.WorksheetFunction.SumIfs
    By flooyd in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-01-2016, 11:22 AM
  5. [SOLVED] Looking for something simpler than SUMIFS - SUMIFS
    By YAbdelaal in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-27-2014, 10:38 AM
  6. SUMIFS Puzzle - Trying to avoid adding multiple SUMIFS to get valid result
    By haldavid in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-09-2013, 03:42 PM
  7. [SOLVED] Sumifs, problem with the formula: =sumifs(c10:c200,<=today(),0)
    By Faustocruz in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-08-2012, 04:26 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