Create variable within a tab

franklinsam

New Member
Joined
Oct 1, 2023
Messages
17
Office Version
  1. 365
Platform
  1. Windows
I am using Office 365 on Windows 11, all updates are installed.


My spreadsheet consists of multiple tabs, each tab has a name, the name is a number that signifies the year (e.g. 2021, 2022, etc.). I want to create a variable that used the tab name. So, I use the formula:
=RIGHT(CELL("filename"),4)
Next I create a variable in the Name Manager, and everything works fine in the sheet that I'm working in, call it 2023. When I go to work in tab 2024 I still get the date from 2023 so I do a Calculate Now and it updates fine however if I go back to tab 2023 it now shows the date as 2024.

While I could create a variable in Name Manager for the tab name and define the variable to the scope of the tab. Is there a better way?
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
I have a running total of values, each has a date associated with the value, the table name is Withdraws
1696326909386.png

from this is I create an overall total and a year to date total. The YTD date formula looks like this
=SUMPRODUCT(--(YEAR(Withdraws[Date])=INT(CurrentYear)),Withdraws[Amount])
 
Upvote 0
You need to include a cell reference like
Excel Formula:
=RIGHT(CELL("filename",A1),4)
 
Upvote 1
Solution
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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