Display first instance of month

Finalfight40

Active Member
Joined
Apr 24, 2018
Messages
273
Office Version
  1. 365
Platform
  1. Windows
Hi All

I have a dates similar to below:

[TABLE="width: 500"]
<tbody>[TR]
[TD]July[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]August[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]02/07/2018[/TD]
[TD]09/07/2018[/TD]
[TD]16/07/2018[/TD]
[TD]23/07/2018[/TD]
[TD]30/07/2018[/TD]
[TD]06/08/2018[/TD]
[TD]13/08/2018[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I would like to know if there is a formula to display the month names above the first instance of that month occurring. Also the following year, the month would would need to appear again (for example July next year would need July above the first instance).

Also my data starts in B13
 
Last edited:

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
I've assumed the dates start in B13:

=IF(OR(A13="",(MONTH(B13)-MONTH(A13))=1,(MONTH(B13)-MONTH(A13))=-11),CHOOSE(MONTH(B13),"January","February","March","April","May","June","July","August","September","October","November","December"),"")

The OR statement checks if there's a difference in months between the date in the same column as the formula and the date in the previous column. If the difference is 1 or -11 (for January) then it displays the month in text from the CHOOSE list. The A13=0 in the OR function is there to cater for the first date only.
 
Upvote 0
Hi Chameleon

I got a value error with your formula, however your use of Choose and explanation gave me a great idea to solve it.

Thank you!
 
Upvote 0
What about this, copied across?

Excel Workbook
BCDEFGHIJKLMNOP
12JulyAugustSeptemberOctober
132/07/20189/07/201816/07/201823/07/201830/07/20186/08/201813/08/201820/08/201827/08/20183/09/201810/09/201817/09/201824/09/20181/10/20188/10/2018
Start of Month
 
Upvote 0
Hi Peter

That explains why when i tried this method i couldn't get the right answer!

When i tried, i used:

Code:
[COLOR=#000000][FONT=Arial]=IF(MONTH[/FONT][/COLOR][COLOR=#000000][FONT=Arial](B13)[/FONT][/COLOR][COLOR=#000000][FONT=Arial]=MONTH[/FONT][/COLOR][COLOR=#000000][FONT=Arial](A13)[/FONT][/COLOR][COLOR=#000000][FONT=Arial],"",TEXT[/FONT][/COLOR][COLOR=#000000][FONT=Arial](MONTH(B13),"mmmm")[/FONT][/COLOR][COLOR=#000000][FONT=Arial])

Which of course always returned January...

Silly mistake.[/FONT][/COLOR]
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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