Cell self-reference in Excel - excel

Is there a way to self-reference the cell inside an expression?
For example:
if I want A2 cell to have +1 value in respect of the cell above I write:
=A1+1
If I cut and paste this expression in another cell, it still references to A1.
How to replace that =A1+1 with something like:
=cell.value(this.X,(this.Y-1))+1
UPDATE
Just another use case: create a numbered list (yes, I know excel lines are already numbered, but what about printing?).
Until now I put 1 in A1, =A1+1 in A2 and then dragged A2 lower right corner down to the desired line.
In this way if I delete a row, the following ones become of undefined value.
By putting =OFFSET(A2;-1;0)+1 in A2 and dragging, I can then delete intermediate lines without breaking the sequence.
I guess there are zillions of better/smarter/faster ways of doing this.

use Offset()
so the cell formula would be:
=OFFSET(A1;-1;0)+1

If you copy&paste the actual contents while editing the cell, paste will then put the exact same text into any other cell you select. If you make sure you are not editing the cell, highlight it, copy and then paste into another cell, Excel will automatically update the column and row.
Highlight the cell when not in edit mode, paste into the one below, it will automatically update the row number, =A1+1 will become =A2+1. If you paste it into the cell to the right, it will update the column letter, =A1+1 will become B1+1.
So, for example, if you have the number 9 in cell A1, then enter =A1+1 in cell A2 it will show a value of 10, if you then copy cell A2 (the cell, not the contents) to cell A3, that cell will display the value 11, and contain =A2+1.
If you want to do a long range of cells that add 1 to the previous cell, taking the previous example, highlight cells A2 and A3 then click and hold on the little square at the bottom right of the selection, and drag it as far down column A as you want.

Related

Creating a Vertical Pattern By Subtracting A Given (Variable) Cell By Another Constant (Fixed) Cell

So basically I am trying to create a pattern in excel by subtracting each of the elements in Column D from just Cell A2. I need the pattern to always subtract the value of the variable column D cell just from cell A2. So I started off setting D2 (after the heading) to (D2-A2). Then I set D3 to (D3-A2). Then I set D4 to (D4-A2). I then highlight these three cells, hoping the pattern was apparent. I click and drag the bottom right corner of the last cell downward, but excel proceeds to give me (D5-A3) for D5, (D6-A4) for D6, (D7-A5) for D7, etc....
Does anyone know how to fix this issue? I want to be able to create this pattern for the column, but it's not able to pick up on it when I drag the lower-right corner of the highlighted cells downwards.
In the first cell, use =(D2-A$2). The "$" makes it so that Excel does not change this component when copy-pasted.

LibreOffice highlight cells if they are the same as a specific range

Master and Step Chart
Hello, I'm using A4-E4 as a "Master" code, and incrementally using A5-A8 to replace A4, B5-B8 to replace B4, etc etc first replacing one number of the "master", then two different numbers, etc until I have basically every combination. At some point the same number as the "master" is going to be generated. I have the numbers separated into groups of 16 on individually sheets for a total of 64 sheets. Obviously at some point the same number "43254" is going to generate on one of the sheets. Is there a way to search/highlight that number automatically upon generation? I've found that I can do conditional formatting to search for a specific cell, but not a range of cells. Like compare "A4-E4" to every set of five adjacent numbers in all the sheets, then highlight it. I have no idea if this is possible, but I'd appreciate it.
Select cells A4 through E4 and go to Format -> Conditional Formatting -> Manage. Apply style Good if Formula is:
CONCATENATE($A4;$B4;$C4;$D4;$E4)="43254"
So 43254 matches.
And 43253 does not match.
This is more complex than first appears. The following explanation may be difficult to understand if you do not have much experience with conditional formatting.
The formula gets evaluated 5 times, once for each of the cells.
Normally, rather than always indicating cell A4, Calc would interpret A4 as the currently evaluated cell (because we selected cells starting from A4). And B4 would indicate the cell to the right of the current cell that is evaulated. So for example, if such a conditional formatting formula were filled to cell D7, then A4 would actually indicate cell D7, and B4 would indicate cell E7.
However, our formula uses $A4 instead. The $ tells Calc that we always want column A even if the formatting is for column B or C et cetera.
One outcome of this is that the formula can be filled down or up but not left or right. If it is filled down one row for example, $A4 refers to column A but the current row, which would be cell A5.

how to create an excel formula with vlookup and if argument

I want to create a formula that looks up for a specific text in the range in provide or column and if it finds the text, write that text or the text in the right column in another cell. I am currently using this formula:
=LOOKUP("Haider",O11:O16,E1:E6)
However even when it can not find Haider in the range O11:O16, it still writes the text in the column E1:E6 to the cell in which I wrote the formula.
Also, as there would be only a single word in the entire column at one time, you
could help me with a formula that simply copies that word to a cell of my choice.
Another question is that how can I combine this with conditional formatting? For example, if I want to find the text and if it is found the range I specify, it should turn another cell into red or any color.
The first part of your question is answered in the comment from Byron Wall.
For the second part of the question, if you want to find the first or only cell containing text in a range, the formula is:-
=IFERROR(VLOOKUP("*", O11:O16, 1,FALSE),"")
If you want to find the first or only cell containing anything, the formula is
=IFERROR(INDEX(O11:O16,MATCH(TRUE,O11:O16<>"",0)),"")
but you have to enter it as an array formula using Ctrl-Shift-Enter.
For the last part of the question, supposing you wanted to highlight the cell in E1:E6 corresponding to the cell in O11:O16 containing "Haider", you would need the formula:-
=$O11="Haider"
(this compares E1 with O11, E2 with O12 etc. because of relative addressing)
Highlight E1 to E6.
Go to 'Conditional Formatting'.
Select 'New Rule' and 'Use a formula...' , enter the formula and choose a fill colour in the Format option.

Copying Excel Formula and controlling relative reference

In Excel I want to copy a formula down and control the relative cell reference.
For example
In A1 if the formula was =B1 and I copied the A1 formula down to A3 the formula in A3 would be =B3. Is there a way of copying the formula in A1 to A3 and have it equal B2?
That's the default copying behaviour in Excel. Did you try it? In fact, if you want to disable it, you have to write $ in front of the fixed row and/or column denominator, so for example $E$1 would be fixed when copied (useful for things that remain constant).
Edit: I think I can imagine what happens: You probably tried to copy the cell contents from the formula editor field. Copy the cell instead, so just mark the cell in the grid by highlighting it, copy it, highlight your target and paste.
Edit2: And please note that you can just drag the little square at the edge of a highlighted cell to apply that cell's formula to an entire area, using the same relative referencing as with copying.

Selecting a range from bottom to top in Excel?

Let's say I need to select a range in Excel from A2 to A1,(if I'm inserting something, it needs to insert to a2 first).
No matter which direction I choose, Excel automatically chooses Sheet1!$A$1:$A$2. I tried to even manually change it to Sheet1!$A$2:$A$1 but that didn't work.
How can I either disable this automatic selection or how to choose a range from bottom to top?
The real alternative would seem to be not to insert into A2 before inserting into A1 but to insert into A2 first and then keep inserting into A2, with Shift cells down.
From bottom to top you have to select range from bottom, like I did in my countif formula:
=COUNTIF($AA$8:AA8,AA8)
I locked AA8 cell and made it range with same cell because there were no other rows above the current row. And criteria was again this cell so I got my result.

Resources