Search code examples
excel-formulaoffice365matchpartialapproximate

xlookup with multiply separate match criteria


I've got 2 tables with same criteria "Num"

I'm using this formula:

=XLOOKUP(1,(NUM=RANGE_NUM)*(DATE=RANGE_DATE),GOAL_ARRAY,,,)**

It's working only for exact match, but I want fill up all rows with goal column result

Current result in table 1

TABLE 1 (several dates with 1-2 days deviance)

Num Date Goal
1136 2022-01-01 250
1136 2022-01-02 =N/A
1136 2022-01-03 =N/A
1136 2022-02-01 500
1136 2022-02-02 =N/A
1136 2022-02-03 =N/A
1136 2022-03-01 250
1136 2022-03-02 =N/A
1136 2022-03-03 =N/A

TABLE 2 (exact date)

Num Date Goal
1136 2022-01-01 250
1136 2022-02-01 500
1136 2022-03-01 250

Is it possible to make "NUM" exact match with "DATE" approximate?

TABLE 3 (expected result)

Num Date Goal
1136 2022-01-01 250
1136 2022-01-02 250
1136 2022-01-03 250
1136 2022-02-01 500
1136 2022-02-02 500
1136 2022-02-03 500
1136 2022-03-01 250
1136 2022-03-02 250
1136 2022-03-03 250

Maybe I have to use other formula combinations? Any suggestions please


Solution

  • Use FILTER():

    =XLOOKUP(B2,FILTER($F$2:$F$5,$E$2:$E$5=A2),FILTER($G$2:$G$5,$E$2:$E$5=A2),"",-1)
    

    enter image description here