Named cells losing their location

hoffortb

New Member
Joined
Jan 12, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I have several cells and ranges of cells that started losing the location assigned to them today. I have a large table that I use for Xlookups and I added data to it today right before the scrambling began. I’m sure that has something to do with this. Also, most of the cells that I have named look like $A1, as I thought this was the best way to be able to carry my formula down a column. *I know that by sorting or filtering my table some named cells are no longer where I expect them to be.

Can anyone help?
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Can you be more specific? What is a specific cell or range that you gave a name to? And what you do you mean by "losing the location"? What was it when you created the name, and what is it now? What is the layout of the table and where did you add data?
 
Upvote 0
Can you be more specific? What is a specific cell or range that you gave a name to? And what you do you mean by "losing the location"? What was it when you created the name, and what is it now? What is the layout of the table and where did you add data?
The problem is that cells that have been given a name (for example A1 is now named Hours_Worked), are not holding the original position given. Meaning that after I name the cell, and resume testing the workbook, I will notice that the spreadsheet is not calculating properly. When I troubleshoot by looking at the Named Cell, it is no longer in A1, it is elsewhere (example is Z58). My theory is that when I added data to the range now table, it messed things up somehow.

Some background; I am modifying a workbook (that has worked in the past) by naming key cells. This is needed to help the person that inherits this workbook after I retire. So instead of A1+B1 in the formula, it will appear as Hours_Worked+Rate_of_Pay, for example. Most, but not all, of these formulas have Named Cells that pull their data from other worksheets. Some of the data is in a table, some of it is locked cells (meaning a cell like $A$1) in other sheets or in the worksheet where the formula resides. I first noticed the problem right after I added more data to the table. I believe that this data was not in a table per se, but in a range, I think it’s called. Anyway, it looked like a table. To try to fix the problem, I converted the range to a table, but this made no difference.

One other thing of note; I struggle with how to setup a cell in the formula such that it is either in a set location ($A$1) or it is the first cell in a column (for example) that I plan to copy into every cell in that column. What I have been doing is when creating the name, the cell that the name refers to is almost always something like $A1. This seems to allow me to copy the formula down the column without issue, until now.

Lastly, I had problems with sorting tables or ranges in the past and I discovered that you can’t do this in tables/ranges that have empty cells. I do not have empty cells, but I worry that my data might be scrambled again, especially since I added about 150 rows of data, about 10 columns across. I inserted the data into the middle of the range/table, thinking that this would retain the dynamic quality of the thing. This workbook was 99% complete UNTIL I added the new data and began testing. I also wonder if by sorting and Filtering the data as I was entering the new data, this has also impacted my named cells somehow. When I sort the data, some of the named cells no longer refer to the data they did before.

Thank you for your interest in helping me! I LOVE developing new tools at work, but admittedly still have a lot to learn.
 
Upvote 0
When you create a name using a relative reference like A1 or $A1, Excel moves the relative part of the reference depending on where you are referencing it from.

For example, suppose I select the cell B1. Then I create a name Corner for cell A1. I put the value 10 in A1. If I put the following formula in B1, it will return 10.
=Corner

However, if I put the value 99 in cell D9, and put the following formula in E9, it will return 99:
=Corner

Because I created the name while I had B1 selected, it will always refer to the cell one column to the left of where it is referenced from.

(If you want formulas to refer to a fixed cell position you must use $ to made the reference absolute.)

$scratch.xlsm
ABCD
11010
2
3
4
5
6
7
8
99999
Relative Named Reference
Cell Formulas
RangeFormula
B1,D9B1=Corner
Named Ranges
NameRefers ToCells
Corner='Relative Named Reference'!C9D9


instead of A1+B1 in the formula, it will appear as Hours_Worked+Rate_of_Pay, for example. Most, but not all, of these formulas have Named Cells that pull their data from other worksheets.
It sounds like maybe you do want to use relative references, since by the sound of it you have multiple rows of Hours_Worked and multiple lines of Rate_Of_Pay. Assuming you really meant "*" instead of "+" I am imagining something like this:

$scratch.xlsm
FGH
1Hours Worked Rate of Pay Total Pay
28 $ 20.00 $ 160.00
38 $ 18.00 $ 144.00
410 $ 22.00 $ 220.00
512 $ 30.00 $ 360.00
66 $ 32.00 $ 192.00
78 $ 24.00 $ 192.00
88 $ 20.00 $ 160.00
Relative Named Reference
Cell Formulas
RangeFormula
H2:H8H2=Hours_Worked*Rate_Of_Pay
Named Ranges
NameRefers ToCells
Corner='Relative Named Reference'!G8H8
Hours_Worked='Relative Named Reference'!$F8H8
Rate_Of_Pay='Relative Named Reference'!$G8H8
 
Upvote 0

Forum statistics

Threads
1,215,123
Messages
6,123,182
Members
449,090
Latest member
bes000

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