Combining Databases

Copper Contributor

Hi, I am having trouble combining databases in excel.  I have two data sets of different sizes. Im going to try to explain this, sorry if it doesn't come out right.

 

Data set A - Main data set

Data set B - A variable(PEEP) is assigned to a certain ID and time. The time intervals are not fixed.

 

The larger database has it own time intervals. I need copy the PEEP from dataset B to dataset A but it has to be the right ID and closest to the day in data set A. Thanks for the help!

 

Data Set A

IDDayPEEP
11.0 
11.4 
12.1 
12.4 
13.0 
13.8 
13.9 
14.0 
14.1 
14.4 
14.6 
14.8 
15.1 
15.4 
15.6 
16.0 
16.1 

 

Data Set B

IDDayPEEP
11.005
11.0310
11.0710
11.1110
11.2010
11.2410
11.2810
11.3210
11.4510
11.6510
1 Reply

@shuelska 

For such sample

image.png

you may try

=INDEX(tblB[PEEP],
     MATCH(1,INDEX(
             (ABS(tblB[Day]-[@Day])=MIN(ABS(tblB[Day]-[@Day]) ) )*
             (tblB[ID]=[@D]),0),
     0)
)