ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   lookup macro (https://www.excelbanter.com/excel-discussion-misc-queries/177026-lookup-macro.html)

BMI

lookup macro
 
Hi,

I have two sheets and need to compare them:
1. The first sheet looks similar to:
Group EVENT START DATE
1 A 12-Jan-08
1 B 22-Feb-08
1 C 12-Mar-08
1 D 19-Nov-08
2 E 25-Nov-08
2 A 25-Dec-08
2 G 25-Jan-09
2 B 25-Feb-09


2. The second sheet looks like:
Group Attendance Attendance Label
1 15-Dec-07 V1
1 10-Jan-08 V2
1 13-May-08 V3
1 20-Aug-08 V4
1 20-Dec-08 V5
2 25-Aug-08 V1
2 30-Dec-08 V2
2 15-Jan-09 V3
2 30-Mar-09 V4

I need to compare the event of each group against the Attendance dates i.e.
to find out between which attendance label the event occurred.
the comparison should yield the following:

Group EVENT START DATE 1st 2nd
Closest
Closest
Attendance
Attendance
Label
label
1 A 12-Jan-08 V1 V2
1 B 22-Feb-08 V2 V3
1 C 12-Mar-08 V2 V3
1 D 19-Nov-08 V4 V5
2 E 25-Nov-08 V1 V2
2 A 25-Dec-08 V1 V2
2 G 25-Jan-09 V2 V3
2 B 25-Feb-09 V2 V3

I can compare using array formulas, but with large amout of data the, not
able to get the results right. Is there a macro that can be written. Please
help


All times are GMT +1. The time now is 02:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com