Excel Dynamic Ranges changing (with no logic) - excel

A confusing one. I'm using a dynamic range
=OFFSET('EA OPs'!A4,0,0,COUNTA('EA OPs'!$A:$A)-1,96)
I've assigned it to rOps in the NAME MANAGER. I've then tried to change a Pivot Table source to rOps. Click in to a random cell. Click back in the NAME MANAGER and it has changed to:
=OFFSET('EA OPs'!G3,0,0,COUNTA('EA OPs'!$A:$A)-1,96)
then
=OFFSET('EA OPs'!G24,0,0,COUNTA('EA OPs'!$A:$A)-1,96)
seemingly at random. Althought it does seem to keep near to the cell I've clicked on?
Any ideas?

You need to anchor the A4 with dollar signs and make it an absolute reference. Otherwise it's relative to whatever cell is active:
=OFFSET('EA OPs'!$A$4,0,0,COUNTA('EA OPs'!$A:$A)-1,96)
Named ranges always behave this way, which can be useful. For example with A2 active, you can create a range named "CellAbove" and set it to "=A1". You can then use it in a formula in any cell, e.g., `=CellAbove/2' and the result will be the value of the cell one row up, divided by 2.

Related

Excel Conditional Formatting Formula Changes After I Apply The Rule

Every time I make a new conditional formatting rule it changes and breaks. This happens before I click apply, but after I have created the rule. If I apply the rule it, naturally, applies completely incorrectly, but I don't have any idea what the formula is checking. If I then edit the text of the formula after applying it, it will then work and stay the way I have written it.
It seems to be just adding a long string of numbers at the end of my formula location.
In the images below I am adding a new formula:
=$J1="N"
but after hitting ok it changes to this:
=$J1048564="N"
Not sure what I am doing wrong here, so any help would be greatly appreciated!
The row number does not have a $ sign, so it is relative. It is relative to the cell that was the active cell when the format was defined.
If you apply a format to A1:A1000, but the currently active cell is in row 500, then a relative reference to $A1 in the formula will be interpreted as "The cell 499 rows above the current cell". When that format is applied, then Excel will try to find that position for each row. In row 1, it cannot go 499 cells above, so it starts over at the last cell of the sheet and goes 499 up from there.
Of course you don't want all that.
So, when you define a conditional format that applies to many rows, make sure that the currently active cell is at the top left of the selected range, so any relative cell references will be applied relative to that cell position.
You may want to remove your CF completely and start over.

How to 'lock' a cell reference so it doesn't change when sorted/filtered?

I have a formula that relies on the values in other specific cells to work correctly, yet have found out that when I sort my worksheet randomly these references are replaced with relative references, or absolute ones if I use $ in the cell numbers. I have tried to 'name' the cells but naming them doesn't make a difference. Is there a way to uniquely identify a cell so I can find it no matter if the sheet is sorted or changed?
If I understand correctly, you want the selected range to stay the same regardless of the cell the formula is run from.
This is called absolute cell reference.
To do this, put dollar signs in front of the row or column you want to stay the same. In your example, using COUNTIF($M$100:$M$105) will select the range M100:M105, even when you copy that formula to a different cell.

How to reference cell within '' worksheet title

I have the names of the tabs/worksheets (M-61,M-62,M-63W) at the top row (A1, B1, C1...etc)
I am trying to get a sum of several cells within the different sheets:
=SUM('M-60'!H21,'M-60'!H43,'M-60'!H86,'M-60'!H87,'M-60'!H97,'M-60'!H98)
However, right now I’m referring to the sheet itself, and have to apply the same formula to all the other sheets. This will require me to manually go and change all the sheet titles accordingly.
I was wondering if there is any way to reference the top row with the sheet titles within the formula so it automatically refers to the row text instead of me having to manually change the sheet title.
Edit
Now i got the reference to work, just wondering how would I do a sum of several cells in that tab
=INDIRECT("'"&$F1&"'!H87",TRUE)
Maybe:
=SUM(INDIRECT("'"&C1&"'!H21"),INDIRECT("'"&C1&"'!H43"),INDIRECT("'"&C1&"'!H86:H87"),INDIRECT("'"&C1&"'!H97:H98"))
(though there may well be a much smarter way).
You can use the INDIRECT function, which uses a string as an argument and converts it to a range. So
=M-60'!H21
is the same as
=INDIRECT("M-60'!H21")
or, if Sheet name is stored in, say, cell C1:
=INDIRECT(C1&"'!H21")
Your example has a SUM, though, which requires some adaptations. This your example:
=SUM('M-60'!H21,'M-60'!H43,'M-60'!H86,'M-60'!H87,'M-60'!H97,'M-60'!H98)
Since you are not using a range, you can convert that SUM into simple addition. Assuming Sheet name in cell C1
=INDIRECT("'"&C1&"'!H21")+INDIRECT("'"&C1&"'!H43")+INDIRECT("'"&C1&"'!H86")+INDIRECT("'"&C1&"'!H87")+INDIRECT("'"&C1&"'!H97")+INDIRECT("'"&C1&"'!H98")
This should solve your problem. More info here
By the way, if you were using a range, the OFFSET function with INDIRECT as an argument would work. But that's not necessary here.

Equal a fixed reference

I wish to create a fixed reference text that will not change dynamically. The reference should not change when I add an extra row, as it usually does. Say, a cell A1 has this content:
=E5
and thus takes the value of cell E5. If I add a new row so the referenced cell is E6, the value of my cell A1 also changes to:
=E6
Is it possible to type in a reference to a cell that will never change dynamically but will remain E5 e.g. no matter how I do cell rearranging?
I namely have a sheet of posts whereto I often add new rows. The topmost post should always be shown in another cell.
For what you describe I think:
=offset(A1,5,4)
would serve (though the more usual requirement is probably "the other way around" - ie keep a cell referenced to a value whose location may change, such as a totals row when further data is added).
offset

How to avoid manually entering this formula in Excel

I'm trying to calculate a value called, "additional throughput". It is calculated by subtracting the base case module's throughput from a new module's throughput.
In the sheet below you can see that for the third row down (has a blue box in it), that the additional throughput is calculated by the formula "=T6-T4".
The problem is that when I click on this box and drag it down to apply the same formula to the other rows, I want the formula to become "=T7-T4" for the next row. Instead it becomes "=T7-T5". I tried to select multiple cells (where the formula was manually entered) before dragging down so it could recognize that the T4 doesn't change, only the first part. However, that didn't work.
In Excel you can use $ signs before the column or row references to make those references "absolute" (rather than "relative"). For example if you use =A$1 then the 1 doesn't change when you copy down. If you use =$A1 then the A doesn't change when you copy across. If you use =$A$1 then neither changes whichever way you go.
So for your case you need to use
=T6-T$4
when you copy that down T$4 doesn't change
You have to make the cell address of T4absolute by pressing F4, so it becomes $T$4. When you then copy the formular to other places T4 will keep its absolute address.
I figured it out.
You put a $ symbol in front of the row and column you want to not change. This is referred to as an absolute reference.
Found out how to do it here:
How do I change an Excel relative cell to an absolute cell?

Resources