Alpha Sort INDEX MATCH with Condition

snt20147

New Member
Joined
Nov 1, 2018
Messages
1
Hello! I want to use INDEX MATCH using Table 1 to create Table 2 that displays only "Winter" and sorts the month alphabetically. I used the following formula which did a great job of sorting by month, but I can't figure out how to get it to select only "Winter".

=INDEX(Month,MATCH(ROWS($C$2:C2),COUNTIF(Month,"<="&Month),0))

Thanks in advance for looking at my post!

Table 1
[TABLE="width: 268"]
<colgroup><col span="2"><col><col></colgroup><tbody>[TR]
[TD]Rank[/TD]
[TD]ID[/TD]
[TD]Month[/TD]
[TD]Season[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]123[/TD]
[TD]January[/TD]
[TD]Winter[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]234[/TD]
[TD]February[/TD]
[TD]Winter[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]345[/TD]
[TD]August[/TD]
[TD]Summer[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]456[/TD]
[TD]April[/TD]
[TD]Spring[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]567[/TD]
[TD]May[/TD]
[TD]Spring[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]678[/TD]
[TD]June[/TD]
[TD]Spring[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]102[/TD]
[TD]September[/TD]
[TD]Fall[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]789[/TD]
[TD]July[/TD]
[TD]Summer[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]901[/TD]
[TD]March[/TD]
[TD]Winter

[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 226"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]Table 2
Month
[/TD]
[TD]

Season
[/TD]
[/TR]
[TR]
[TD]February[/TD]
[TD]Winter[/TD]
[/TR]
[TR]
[TD]January[/TD]
[TD]Winter[/TD]
[/TR]
[TR]
[TD]March[/TD]
[TD]Winter[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
If you use helper columns I and J in my example, you can pull all winter records. Then you can use your formula on that to sort.

Book1
ABCDEFGHIJ
1RankIDMonthSeasonmonthSeasonmonthSeason
21123JanuaryWinterFebruaryWinterJanuaryWinter
32234FebruaryWinterJanuaryWinterFebruaryWinter
43345AugustSummerMarchWinterMarchWinter
51456AprilSpring#NUM!#NUM!
62567MaySpring#NUM!#NUM!
73678JuneSpring#NUM!#NUM!
83102SeptemberFall#NUM!#NUM!
91789JulySummer#NUM!#NUM!
102901MarchWinter#NUM!#NUM!
Sheet1
Cell Formulas
RangeFormula
F2{=IF(ROWS(F$2:F2)>COUNTIF($D$2:$D$10,"winter"),"",INDEX($I$2:$I$9,MATCH(ROWS($I$2:I2),COUNTIF($I$2:$I$9,"<="&$I$2:$I$9),0)))}
G2{=IF(ROWS(F$2:F2)>COUNTIF($D$2:$D$10,"winter"),"",INDEX($J$2:$J$9,MATCH(ROWS($J$2:J2),COUNTIF($I$2:$I$9,"<="&$I$2:$I$9),0)))}
I2{=IF(ROWS(F$2:F2)>COUNTIF($D$2:$D$10,"winter"),"",INDEX($C$2:$C$10,SMALL(IF($D$2:$D$10="winter",ROW($D$2:$D$10)-ROW($D$2)+1),ROWS($I$2:I2))))}
J2{=INDEX($D$2:$D$10,SMALL(IF($D$2:$D$10="winter",ROW($D$2:$D$10)-ROW($D$2)+1),ROWS($I$2:J2)))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Hi,

=LOOKUP(1,0/FREQUENCY(ROWS(C$2:C2),COUNTIFS(Season,Season,Season,"Winter",Month,"<="&Month)),Month)

No need for CSE.

Regards
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,189
Members
452,616
Latest member
intern444

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