sheet name into cell

JOEE1979

Active Member
Joined
Dec 18, 2022
Messages
250
Office Version
  1. 365
Platform
  1. Windows
My sheet names are years (2024, 2025, 2026....)
In column A, I would like to put the date starting with 1 Jan and use the sheet name to make the year.
I would like this to continue all the way to 31 Dec (sheet name)

Is this possible?
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Upvote 0

What if I'm starting on row 5 and I have merged rows?

Project tracker (1)1111.xlsx
A
65 Jan 2025
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2625 Jan 2025
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
4645 Jan 2025
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
2025
Cell Formulas
RangeFormula
A6,A26,A46A6=ROW()-1&" Jan "&TEXTAFTER(CELL("filename"),"]")
 
Upvote 0
If you type the first date in the first merged cell, you could simply drag it down the column.
 
Upvote 0
I'll step back, I don't do merged cells. Hopefully you'll get an answer soon.
 
Upvote 0
I adapted @kevin9999 answer, but this doesn't deal with merged cells since you can't spill over them.
Excel Formula:
=LET(y,NUMBERVALUE(TEXTAFTER(CELL("filename"),"]")),d,IF(OR(MOD(y,400)=0,AND(MOD(y,4)=0,MOD(y,100)<>0)),366, 365),SEQUENCE(d,,0)+DATE(y,1,1))
 
Upvote 0
I should mention that getting the sheet name like this to extract the year is very volatile. I suggest you have a cell that contains the year and reference it instead.
 
Upvote 0
Here's the first result from a Google search.

You must refresh the calculations every time you're on a certain sheet to get the correct year. Otherwise, the year will show whatever the last time you refresh the calculation.
For example, if I ran the above formula for "2024", if I go to "2025". All the dates will show "2024", I must refresh to get 2025. Now if I go back to 2024, it says 2025.

In short, not a good idea because it can have unexpected consequences.
 
Upvote 0

Forum statistics

Threads
1,215,256
Messages
6,123,911
Members
449,132
Latest member
Rosie14

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