Help with linking events in one table to specific location in another table

dennisridgley

New Member
Joined
Aug 12, 2014
Messages
4
Good morning!

We are a healthcare provider and need to track where falls occur. Patients can be in one or more locations and have one or more falls in a perod. I've been trying to use INDEX/MATCH functions to identify the location for each fall, by first identiying the patient by their ID (uique identifier) from the first table to the second table then by the date range, but can't get it done. In the example below, Mr. Skywalker has two falls. The first on 12/25 should have a locatio of "North" the second on 12/28 should have the location of "Central". I'm new to VBA which is why I'm trying do do Excel functions, but a Macro that solves this will be welcome as well. Thanks for your help!! - Dennis

[TABLE="width: 632"]
<colgroup><col width="108" style="width: 81pt; mso-width-source: userset; mso-width-alt: 3949;"> <col width="75" style="width: 56pt; mso-width-source: userset; mso-width-alt: 2742;"> <col width="110" style="width: 83pt; mso-width-source: userset; mso-width-alt: 4022;"> <col width="73" style="width: 55pt; mso-width-source: userset; mso-width-alt: 2669;"> <col width="90" style="width: 68pt; mso-width-source: userset; mso-width-alt: 3291;"> <col width="73" style="width: 55pt; mso-width-source: userset; mso-width-alt: 2669;" span="2"> <col width="64" style="width: 48pt;" span="2"> <col width="111" style="width: 83pt; mso-width-source: userset; mso-width-alt: 4059;"> <tbody>[TR]
[TD="width: 108, bgcolor: transparent"]Patient[/TD]
[TD="width: 75, bgcolor: transparent"]ID[/TD]
[TD="width: 110, bgcolor: transparent"]Location[/TD]
[TD="width: 73, bgcolor: transparent"]Date of Fall[/TD]
[TD="width: 90, bgcolor: transparent"]Type of Fall[/TD]
[TD="width: 73, bgcolor: transparent"]Location[/TD]
[TD="width: 73, bgcolor: transparent"][/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 111, bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]Skywalker, Luke[/TD]
[TD="bgcolor: transparent"]123456[/TD]
[TD="bgcolor: transparent"]Home[/TD]
[TD="bgcolor: transparent"]12/25/2017[/TD]
[TD="bgcolor: transparent"]Fall with Injury [/TD]
[TD="bgcolor: transparent"] [/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]Skywalker, Luke[/TD]
[TD="bgcolor: transparent"]123456[/TD]
[TD="bgcolor: transparent"]SNF/Nursing Home[/TD]
[TD="bgcolor: transparent"]12/28/2017[/TD]
[TD="bgcolor: transparent"]Fall with Injury [/TD]
[TD="bgcolor: transparent"] [/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]ID[/TD]
[TD="bgcolor: transparent"]Patient Last[/TD]
[TD="bgcolor: transparent"]Patient First[/TD]
[TD="bgcolor: transparent"]Admit date[/TD]
[TD="bgcolor: transparent"]TERMINATION_DATE[/TD]
[TD="bgcolor: transparent"]Start of Care[/TD]
[TD="bgcolor: transparent"]End of Care[/TD]
[TD="bgcolor: transparent"]dbo_RES_BASIC.ORGANIZATION_NAME[/TD]
[TD="bgcolor: transparent"]Location[/TD]
[TD="bgcolor: transparent"]Referral[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]234567[/TD]
[TD="bgcolor: transparent"]Ren[/TD]
[TD="bgcolor: transparent"]Kylo[/TD]
[TD="bgcolor: transparent"]12/24/2017[/TD]
[TD="bgcolor: transparent"] [/TD]
[TD="bgcolor: transparent"]12/24/2017[/TD]
[TD="bgcolor: transparent"] [/TD]
[TD="bgcolor: transparent"]Admitted-Home[/TD]
[TD="bgcolor: transparent"]South[/TD]
[TD="bgcolor: transparent"]Medical Hospital[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]123456[/TD]
[TD="bgcolor: transparent"]Skywalker[/TD]
[TD="bgcolor: transparent"]Luke[/TD]
[TD="bgcolor: transparent"]12/9/2017[/TD]
[TD="bgcolor: transparent"] [/TD]
[TD="bgcolor: transparent"]12/18/2017[/TD]
[TD="bgcolor: transparent"]12/25/2017[/TD]
[TD="bgcolor: transparent"]Admitted-Home[/TD]
[TD="bgcolor: transparent"]North[/TD]
[TD="bgcolor: transparent"]Fowl Medical[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]123456[/TD]
[TD="bgcolor: transparent"]Skywalker[/TD]
[TD="bgcolor: transparent"]Luke[/TD]
[TD="bgcolor: transparent"]12/9/2017[/TD]
[TD="bgcolor: transparent"] [/TD]
[TD="bgcolor: transparent"]12/26/2017[/TD]
[TD="bgcolor: transparent"]12/28/2017[/TD]
[TD="bgcolor: transparent"]Relocation-Home to Care Center[/TD]
[TD="bgcolor: transparent"]Central[/TD]
[TD="bgcolor: transparent"]Fowl Medical[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]123456[/TD]
[TD="bgcolor: transparent"]Skywalker[/TD]
[TD="bgcolor: transparent"]Luke[/TD]
[TD="bgcolor: transparent"]12/9/2017[/TD]
[TD="bgcolor: transparent"] [/TD]
[TD="bgcolor: transparent"]12/29/2017[/TD]
[TD="bgcolor: transparent"] [/TD]
[TD="bgcolor: transparent"]Relocation-Care Center to Facility[/TD]
[TD="bgcolor: transparent"]West[/TD]
[TD="bgcolor: transparent"]Fowl Medical[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]456789[/TD]
[TD="bgcolor: transparent"]Yoda[/TD]
[TD="bgcolor: transparent"]Mister[/TD]
[TD="bgcolor: transparent"]11/19/2017[/TD]
[TD="bgcolor: transparent"]12/18/2017[/TD]
[TD="bgcolor: transparent"]11/19/2017[/TD]
[TD="bgcolor: transparent"]12/12/2017[/TD]
[TD="bgcolor: transparent"]ReAdmit[/TD]
[TD="bgcolor: transparent"]South[/TD]
[TD="bgcolor: transparent"]Center Clinic[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]456789[/TD]
[TD="bgcolor: transparent"]Yoda[/TD]
[TD="bgcolor: transparent"]Mister[/TD]
[TD="bgcolor: transparent"]11/19/2017[/TD]
[TD="bgcolor: transparent"]12/18/2017[/TD]
[TD="bgcolor: transparent"]12/14/2017[/TD]
[TD="bgcolor: transparent"]12/18/2017[/TD]
[TD="bgcolor: transparent"]Discharge[/TD]
[TD="bgcolor: transparent"]South[/TD]
[TD="bgcolor: transparent"]Center Clinic[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi Dennis,

Maybe try;


Book1
ABCDEFGHI
1IDPatient LastPatient FirstAdmit dateTERMINATION_DATEStart of CareEnd of CareLocation
2234567RenKylo12/24/201712/24/2017Admitted-HomeSouth
3123456SkywalkerLuke12/09/201712/18/201712/25/2017Admitted-HomeNorth
4123456SkywalkerLuke12/09/201712/26/201712/28/2017Relocation-Home to Care CenterCentral
5123456SkywalkerLuke12/09/201712/29/2017Relocation-Care Center to FacilityWest
6456789YodaMister11/19/201712/18/201711/19/201712/12/2017ReAdmitSouth
7456789YodaMister11/19/201712/18/201712/14/201712/18/2017DischargeSouth
8
9
10PatientIDLocationDate of FallType of FallLocation
11Skywalker, Luke123456Home12/25/2017Fall with InjuryNorth
12Skywalker, Luke123456SNF/Nursing Home12/28/2017Fall with InjuryCentral
Sheet1
Cell Formulas
RangeFormula
F11=INDEX($I$2:$I$7,MATCH(B11&D11,INDEX($A$2:$A$7&$G$2:$G$7,),0))
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,269
Members
452,628
Latest member
dd2

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