Returning a value based on Day & Date

Phil_L

New Member
Joined
Oct 31, 2023
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Hi all.

I am trying to work out how to pull data from one sheet into another and return it based on the day and date that it happened.

Context: I work in a hospital and we are trying to work out how many patients came into ICU week by week from the data we input.

If you look at the pictures added, In the January sheet, there are 2 patients added and 1 patient in the February sheet. On the Data sheet, it shows 2 patients added for January and 1 Patient added for February however, the patient added at the bottom of the January sheet, although the week begins in January, the patient should be in February's tally.

Is there a formula I can add so that any patients added into the end of a week will show on the month that it should in the data sheet.

I hope this make sense. (Apologies, I cannot install XL2BB de to my computer being part of an organisation)

Regards
 

Attachments

  • 1.png
    1.png
    49.3 KB · Views: 24
  • 2.png
    2.png
    44.1 KB · Views: 24
  • 3.png
    3.png
    49.2 KB · Views: 25
  • 4.png
    4.png
    27.5 KB · Views: 25

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hi, Please explain a little more of this statement "Is there a formula I can add so that any patients added into the end of a week will show on the month that it should in the data sheet"

You want "Patient B" of January month to be added against January or February month in "Data Sheet". Also are you counting "Date form Submitted" or "Date of Operation"

Thanks
 
Upvote 0
Hi, Please explain a little more of this statement "Is there a formula I can add so that any patients added into the end of a week will show on the month that it should in the data sheet"

You want "Patient B" of January month to be added against January or February month in "Data Sheet". Also are you counting "Date form Submitted" or "Date of Operation"

Thanks
Apologies, I thought I had explained it a bit better than I did.

'Patient B' needs to be added into the February month on the Data sheet as the "Date of Operation" is actually in February but due to the week beginning in January that is why it is on the January Sheet. The "Date form Submitted" is not recorded so is not needed for the Data sheet. We only need to reference from the "Date of Operation" to show in the relevant month on the Data sheet.

Apologies if I have over complicated it again.
 
Upvote 0
Since yours is an image file, i tried on a sample data, my bad. I hope someone can help you.
Returning a value based on Day & Date.xlsx
ABC
1Week Commencing
21-Jan-23Patient 1Patient 2
3Patient NamePatient A
4Data-
5Data-
6Data-
7DFS29-Dec-23
8DOO02-Jan-24
9DAYTuesday
10
11Week Commencing
1229-Jan-24Patient 1Patient 2
13Patient NamePatient B
14Data-
15Data-
16Data-
17DFS26-Dec-23
18DOO01-Feb-24
19DAYThursday
Jan

Returning a value based on Day & Date.xlsx
ABC
1Week Commencing
25-Feb-23Patient 1Patient 2
3Patient NamePatient A
4Data-
5Data-
6Data-
7DFS29-Dec-23
8DOO08-Feb-24
9DAYThursday
Feb

Expected Output:
Returning a value based on Day & Date.xlsx
ABCDEFGHI
1Daily Act
2MondayTuesdayWednesdayThursdayFridaySaturdaySundayTotal
3January01000001
4February00020002
Data

Thanks
 
Upvote 0
Since yours is an image file, i tried on a sample data, my bad. I hope someone can help you.
Returning a value based on Day & Date.xlsx
ABC
1Week Commencing
21-Jan-23Patient 1Patient 2
3Patient NamePatient A
4Data-
5Data-
6Data-
7DFS29-Dec-23
8DOO02-Jan-24
9DAYTuesday
10
11Week Commencing
1229-Jan-24Patient 1Patient 2
13Patient NamePatient B
14Data-
15Data-
16Data-
17DFS26-Dec-23
18DOO01-Feb-24
19DAYThursday
Jan

Returning a value based on Day & Date.xlsx
ABC
1Week Commencing
25-Feb-23Patient 1Patient 2
3Patient NamePatient A
4Data-
5Data-
6Data-
7DFS29-Dec-23
8DOO08-Feb-24
9DAYThursday
Feb

Expected Output:
Returning a value based on Day & Date.xlsx
ABCDEFGHI
1Daily Act
2MondayTuesdayWednesdayThursdayFridaySaturdaySundayTotal
3January01000001
4February00020002
Data

Thanks
Thank you for your help
 
Upvote 0
How about?:
I added some example data to test for november and december.
The data is filtered by the column A with the exact text "Date of Operation (DD/MM/YYYY)". If this is not exactly that text it won't work. If it has a line break for example.
There are other solution but I would need to see a complete month sheet. If the date we are interested in is in always in rows 8,18,28,38 and 48 we could use that information to filter the data.
Also i don't know how many patients columns there could be. I am considering from column B to column Z.


Book1
ABCDEFGHI
1Daily Act
2MondayTuesdayWednesdayThursdayFridaySaturdaySundayTotal
3January-1-----1
4February---2---2
5March--------
6April--------
7May--------
8June--------
9July--------
10August--------
11September--------
12October--------
13November11111--5
14December233322621
Data
Cell Formulas
RangeFormula
B3:H14B3=LET( t,VSTACK(INDIRECT("'"&$A3&"'!A1:A100"),IFERROR(INDIRECT("'"&$A2&"'!A1:A100"),"")), d,VSTACK(INDIRECT("'"&$A3&"'!B1:Z100"),IFERROR(INDIRECT("'"&$A2&"'!B1:Z100"),"")), fd,TOCOL(FILTER(d,(t="Date of Operation (DD/MM/YYYY)"))), res,FILTER(fd,(fd>0)*(TEXT(fd,"mmmm")=$A3)*(TEXT(fd,"dddd")=B$2)), IFERROR(COUNT(res),0) )
I3:I14I3=SUM(B3:H3)
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,239
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top