Return Column Header of first entry in range meeting a criteria

esmithuk

New Member
Joined
Oct 18, 2007
Messages
2
I have been working on this for about a day now, searched everywhere and cannot seem to find a solution

I need to return the column header of the earliest entry which meets a particular Phase in column A, i.e. for Phase 3 I would expect formula to return May-19.


Excel 2013/2016
ABCDEFGHIJ
1PhaseDescriptionActivity ID01-Jan01-Feb01-Mar01-Apr01-May01-Jun01-Jul
21100
32100
41100
51100
62100100
73100
81100
93100100
103100
11
12
1301-Feb
1401-Feb
Sheet1

I already have these 2 formulas which both return the earliest entry without Phase:

In D13:
{=INDEX(D1:J1,SMALL(IF((D2:J10<>0),COLUMN(D1:J1)-COLUMN(D1)+1,""),1))}

In D14:
{=INDEX($D$1:$J$1,MATCH(MIN(IF($D$2:$J$10<>"",COLUMN($D$1:$J$1)-1)),COLUMN($D$1:$J$1)-1,0))}

They both return Feb-19, but I need the result to be May-19, the earliest entry for Phase 3. As soon as I include multiple criteria in the match part, by looking at all entries that equal 3 in column A i get error.

What do need to include to consider the entries in column A?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
A solution (I always look for a solution then try to improve on it) is to use a helper column.
I assumed you'd run till December, so I put a helper column P2:P10

Code:
=IF($A$17=A2,MATCH(FALSE,ISBLANK(D2:O2),0),"")

This is an array formula so it needs CTRL+Shift+Enter in P2 and filled down thereafter.

Then, in A17 I put the Phase (e.g., 3) and in B17 (formatted for the date style you want):

Code:
=INDEX(D1:O1,SMALL(P2:P10,1))

HTH
 
Last edited:
Upvote 0
Thanks kweaver

Yes I'm aware I can use a helper column, or even a helper row .... I am trying to avoid this strategy.

Cheers
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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