Forum Discussion

Jesant1605's avatar
Jesant1605
Copper Contributor
Oct 06, 2023
Solved

extracting data using multiple conditions

Hi,

 

I've got a dataset which i want to summarise. in column 2 in the summary table below, i want to bring back a count of total number of instances were the following conditions are fulfilled in the dataset. 

 

1. the "hospital" column is only NPH

2. and the "destination" column is only "home",  

3. and the "service" column is "reablement"

4. and the week ending column date matches the date in the summary. 

 

in this instant the summary table for 07/01/23, column 2 would only be 1, but is there a formula that would bring this back using the conditions above.

 

what adjustment would i need to make to the formula so that in column 3 of the table, conditions 1,2,4 still apply but condition 3 is adapted so that it brings back anything other than "reablement". 

 

In column 4 of the summary, how would i bring back the sum of total number of hrs in the "weekly hrs column"  in the dataset meeting all the 4 conditions above? 

 

SUMMARY

Week endingNumber per week Home care reablementNumber per week Home care othertotal hours per week  homecare reablementtotal hours per week  homecare other
07/01/2023    
14/01/2023    
21/01/2023    
28/01/2023    

 

DATASET 

Hospital Hospital Discharge DateDestination on dischargeService Weekly cost  Wkly HoursMonthweek ending
Woodlands Hall06/01/2023HomeInterim£212.98        12.83January07/01/2023
NPH07/01/2023HomeReablement£189.0010.50January07/01/2023
NPH09/01/2023HomeReablement£419.9423.33January14/01/2023
NPH09/01/2023NursingKnights Court£1,600.00 January14/01/2023
NPH09/01/2023ResidentialKent House£1,100.00 January14/01/2023
Charing Cross09/01/2023HomeReablement£588.0632.67January14/01/2023
NPH09/01/2023HomeInterim£212.98        12.83January14/01/2023
NPH09/01/2023NursingRowan weald£1,250.00 January14/01/2023
NPH10/01/2023HomeInterim£309.92        18.67January14/01/2023
NPH13/01/2023HomeInterim£44.32          2.67January21/01/2023
NPH15/01/2023HomeInterim£77.52          4.67January21/01/2023
NPH22/01/2023HomeReablement£273.0615.17January28/01/2023
Ealing23/01/2023ResidentialSancroft£460.10 January28/01/2023
NPH23/01/2023ResidentialSt Joseph£457.28 January28/01/2023

4 Replies

  • Jesant1605 

    Let's say your data are on Sheet1.

    In B2 on the summary sheet:

     

    =COUNTIFS(Sheet1!$A$2:$A$15,"NPH",Sheet1!$C$2:$C$15,"Home",Sheet1!$D$2:$D$15,"Reablement",Sheet1!$H$2:$H$15,$A2)

     

    In C2:

     

    =COUNTIFS(Sheet1!$A$2:$A$15,"NPH",Sheet1!$C$2:$C$15,"Home",Sheet1!$D$2:$D$15,"<>Reablement",Sheet1!$H$2:$H$15,$A2)

     

    In D2:

     

    =SUMIFS(Sheet1!$F$2:$F$15,Sheet1!$A$2:$A$15,"NPH",Sheet1!$C$2:$C$15,"Home",Sheet1!$D$2:$D$15,"Reablement",Sheet1!$H$2:$H$15,$A2)

     

    In E2:

     

    =SUMIFS(Sheet1!$F$2:$F$15,Sheet1!$A$2:$A$15,"NPH",Sheet1!$C$2:$C$15,"Home",Sheet1!$D$2:$D$15,"<>Reablement",Sheet1!$H$2:$H$15,$A2)

     

    Fill down.

Resources