# Array Formula Lookup based on two variables

#### maxhewitt

##### New Member
Good afternoon!

I'm trying to create an array formula that will return a text string from a list of text/Month items.

Here is what I have so far:

=IF(MONTH(Completed!D2:D4)=12,IF(MIN(Completed!B2:B4),Completed!A2:A4,"NONE"))

The idea is that Column D contains a list of file completion dates, Column B contains the original file dates and Column A contains the text value to return.

The formula should return the text from the row with the oldest original file date that was completed in December (or return "NONE" if nothing is found).

Neat idea, but it doesn't work. What am I doing wrong here?

### Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Welcome to the board!

Try:

=IF(SUMPRODUCT(--(MONTH(C2:C20)=12)),LOOKUP(2,1/((B2:B20=MAX(IF(MONTH(C2:C20)=12,B2:B20)))*(MONTH(C2:C20)=12)),A2:A20),"NONE")

Normal enter.

maxhewitt said:
Good afternoon!

I'm trying to create an array formula that will return a text string from a list of text/Month items.

Here is what I have so far:

=IF(MONTH(Completed!D2:D4)=12,IF(MIN(Completed!B2:B4),Completed!A2:A4,"NONE"))

The idea is that Column D contains a list of file completion dates, Column B contains the original file dates and Column A contains the text value to return.

The formula should return the text from the row with the oldest original file date that was completed in December (or return "NONE" if nothing is found).

Neat idea, but it doesn't work. What am I doing wrong here?

Let A2 on the formula sheet house a first day date of the month/year of interest like 1-Dec-04...

B2:

=LOOKUP(REPT("z",255),CHOOSE({1,2},"NONE",INDEX(Completed!\$A\$2:\$A\$4,MATCH(MIN(IF(Completed!\$D\$2:\$D\$4-DAY(Completed!\$D\$2:\$D\$4)+1=A2,Completed!\$B\$2:\$B\$4,"")),IF(Completed!\$D\$2:\$D\$4-DAY(Completed!\$D\$2:\$D\$4)+1=A2,Completed!\$B\$2:\$B\$4,""),0))))

which must be confirmed with control+shift+enter.

If you have the morefunc.xll add-in:

=LOOKUP(REPT("z",255),CHOOSE({1,2},"NONE",INDEX(Completed!\$A\$2:\$A\$4,MATCH(MIN(SETV(IF(Completed!\$D\$2:\$D\$4-DAY(Completed!\$D\$2:\$D\$4)+1=A2,Completed!\$B\$2:\$B\$4,""))),GETV(),0))))

which still must be confirmed with control+shift+enter.

You can also invoke smaller formulas in multiple cells to obtain the same result.

Replies
5
Views
181
Replies
0
Views
157
Replies
4
Views
740
Replies
7
Views
274
Replies
1
Views
124

1,212,131
Messages
6,106,123
Members
447,996
Latest member

### 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.

### Which adblocker are you using?

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

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