Matching ID and Date where date only matches month/year

Wishmaster89

Board Regular
Joined
Jan 10, 2022
Messages
77
Office Version
  1. 2021
  2. 2019
  3. 2016
Platform
  1. Windows
  2. MacOS
Hi All

I have two sets of ID's and dates that i want to return the period code for. The dates are usually out by 1 day or 2(rarely) so I want to match the ID and month/year.

Can anyone help please?

This is what i currently have

Excel Formula:
=INDEX(C1:C5,MATCH(A1&B1,F:F&G:G,0))

Book1
ABCDEFGH
1IDDate 1PeriodIDDate 2Return period where month/year matches
2103/10/2022R1104/10/2022#N/A
3210/04/2022R2211/04/2022
4329/03/022R3330/03/2022
5401/08/2021R4402/08/2022
Sheet1
Cell Formulas
RangeFormula
H2H2=INDEX(C1:C5,MATCH(A1&B1,F:F&G:G,0))
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hi,

Try it this way:

Book3.xlsx
ABCDEFGH
1IDDate 1PeriodIDDate 2period where ID & month/year matches
2110/3/2022R1110/4/2022R1
324/10/2022R224/11/2022R2
433/29/2022R333/30/2022R3
548/1/2022R448/2/2022R4
Sheet1071
Cell Formulas
RangeFormula
H2:H5H2=LOOKUP(2,1/((A$2:A$5=F2)*(MONTH(B$2:B$5)=MONTH(G2))*(YEAR(B$2:B$5)=YEAR(G2))),C$2:C$5)
 
Upvote 0
Solution
Thanks @jtakw

That worked!

What does the 2,1 do bit do, i can't get my head around it.

You're welcome, thanks for the feedback.

LOOKUP(2,1/((A$2:A$5=F2)*(MONTH(B$2:B$5)=MONTH(G2))*(YEAR(B$2:B$5)=YEAR(G2))),C$2:C$5)

Red part, we built an array based on certain conditions, 1 is divided by this array to produce #DIV/0! error for the Non-matched
This array now consists of 1 for matched, and #DIV/0! for non matched, LOOKUP ignores the errors.
LOOKUP is looking for 2, but only finds the 1, so results in the corresponding value in GREEN.
 
Upvote 0

Forum statistics

Threads
1,215,558
Messages
6,125,511
Members
449,236
Latest member
Afua

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