Indexing or looking up with two different criteria for multiple matches

cagriyuksel

New Member
Joined
Mar 8, 2018
Messages
3
Hi all,

I have two different measures (measure 1, measure 2), in two different spreadsheets (sheet 1, sheet2), with different values.
These measures are carried out for each study participant (David, Maria and Bob) several times on different dates. I'm trying to bring together the dates of the two measures for each participant if these measures are done within 30 days (before or after) of each other, or those of the two measures with the closest dates, for each participant. (example pasted below)

I tried to tackle this using index, match, if and day functions in spreadsheet 2, in a separate column: =INDEX(Sheet2!B:B,MATCH(Sheet2!A2, IF(OR(DAY(Sheet2!B:B-Sheet1!B:B)<30, DAY(Sheet2!B:B Sheet1!B:B)>-30), Sheet2!A:A),0))

but this doesn't seem to work. Can anybody please help me with this? I'm pasting the example below.

Thank you!

Cagri

Sheet1:
Subject Measure1 Date Value
David3/27/201529
David2/28/201648
David4/1/20178
Maria1/15/201413
Maria11/18/201647
Bob3/5/201736
Bob3/6/201814

<tbody>
</tbody>


Sheet2:
SubjectMeasure2 DateValueMatching Measure1 Date
David3/16/201535#NUM!
David2/28/2016643/16/2015
Maria1/24/201413#NUM!
Maria1/5/2016631/24/2014
Maria11/26/2017691/24/2014
Bob8/6/2014102#NUM!
Bob3/5/201798#NUM!
Bob3/26/20181158/6/2014

<tbody>
</tbody>

<tbody>
</tbody>

cT9Cf7

cT9Cf7
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
I want to correct the formula in my question, it's actually: =INDEX(Sheet1!B:B,MATCH(Sheet2!A2, IF(OR(DAY(Sheet2!B:B-Sheet1!B:B)<30, DAY(Sheet2!B:B-Sheet1!B:B)>-30), Sheet1!A:A),0))

[h=2][/h]
 
Upvote 0
I am in UK and dates go to day month year so 3/5/2017 is the same as 5/3/2017 and your dates appear as text - sorry
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,867
Members
449,053
Latest member
Mesh

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