Array Formula Lookup based on two variables

maxhewitt

New Member
Joined
Nov 29, 2005
Messages
1
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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

fairwinds

MrExcel MVP
Joined
May 15, 2003
Messages
8,638
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.
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
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.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,797
Messages
5,833,738
Members
430,228
Latest member
Normano

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
Top