Sort data in the output range.
Select cell G5 and click the Sort button [Data tab, Sort & Filter group].
Click the Sort by arrow and choose Image for the first level.
Verify that the Sort On selection is Cell Values and the Order is A to Z.
Click Add Level and choose Month as the Then by selection.
Verify or select Cell Values and Oldest to Newest for the second level.