Offset Function only works horizontally - excel

I am able to pull a specific cell every 7th column with my OFFSET function, but it only pulls the correct number when I drag right, I need to drag out the formula down, thus filling my column with the correct information. Please help!
This is the formula I am currently using
=OFFSET(Shift!$AFV$14,0,(COLUMN(Shift!A1)*7))

Ok, let's breakdown your formula:
=OFFSET(Shift!$AFV$14,0,(COLUMN(Shift!A1)*7))
OFFSET is using this cell as the base:
Shift!$AFV$14
Because you used $ notation, it will ALWAYS reference that cell, regardless of where you copy this formula.
0
The next parameter, 0, says you want to work 0 rows offset. So the same row as $AFV$14 is on (ie row 14).
(COLUMN(Shift!A1)*7)
The final parameter you are telling it how many columns to offset.
You are using COLUMN function to pull the column NUMBER of the passed cell (in this case: Shift!A1
Because you did NOT use the $ notation, this cell reference WILL CHANGE when you copy the cell around.
So if you copy the cell to the right, it will read:
Shift!B1
if you copy it down, it will read:
Shift!A2
.. etc.
I'm not really sure why you are doing it this way, nor am I sure what you are trying to accomplish in the first place - so it's hard for me to correct the formula.
Hopefully with this explanation you can understand why it's only shifting to the right/left ... "because you told it to".

Related

I want to copy a formula which ends in a number, but amend the number in the new formula by a fixed value

In Cell F190 I have the following formula: ='[Account 19617768.xlsx]19617768'!$G$1142 (the cell displays the value in 19617768 $G$1142 - (£1609.50)
I can display this formula in Cell J190 with the formula: =FORMULATEXT(F190)
By manipulating FORMULATEXT(F190) (i.e. Using Left(FORMULATEXT(F190),38)&(Right(FORMULATEXT(F190),4)+2), I end up with Cell J190 displaying formula: ='[Account19617768.xlsx]19617768'!$G$1144.
What I need is for Cell J190 NOT to display the formula, but the actual value in Account19617768.xlsx G1144 (£1859.50), and it's the conversion of the formula into the value I don't seem to be able to find an appropriate function
I don't have a problem if I need to use an additional function in another cell to finish off the conversion?
I know this should be easy, but having just been released from hospital, I seem to be having
trouble working the simplest things out
'$' signs in excel formula keep the preceding data static.
In other words. Remove the $ in G$1065.
Now when you drag the formula down the column the Cell number will increase.
If you keep the $ in front of G the column G will never change no matter where the formula is copied.

EXCEL: When dragging cells to the right I need to use information stored in columns not rows (Not sure how to ask this properly)

It's probably a simple problem, but I did not even know the keywords to google it ;/. Let's say I have this data :
Now I also have this litle formula:
If I know drag the C cell to the right, Excel will attempt the following caluclation:
=2+B1
What I want him to do is to attempt this calculation
=2+A2
Of course the easiest solution would be to store my initial data in one row instead of 1 column, but it is really inconvenient for me. Thanks for any help
You can use the indirect() method to reference a cell by it's "String identifier", i.e. "A3". When filling out to the right, use CONCATENATE() and COLUMN() to create your String identifiers {A1,A2,A3,A4,A5...} as required:
=2+INDIRECT(CONCATENATE("A";COLUMN()-2))
This will result in the following:
Side-Node: If you want this for some x/y-Grid-Generation, you can also be lazy,
and just insert =COLUMN() for every cell from "A1 - Z1" and ROW() for every cell from "A2 - A24".
(Or even avoid these at all and directly perform your actual calculation by using column() and row() as replacement for your x/y.
You may try using a combination of the INDIRECT and COLUMN functions:
=2+INDIRECT("A"&(COLUMN()-2))
You would paste the above formula into cell C1, and then drag across to the right however many columns/rows you wanted to cover.
This would result in the following:
This works because COLUMN()-2 returns 1 for the C column, 2 for the D column, and so on. Therefore, the formula will be calling INDIRECT on A1, A2, etc. for column C, D, and so on.
In general, if you want relative references to move down as cells are dragged to the right, you can use this:
Instead of:
= 2+A1
Do:
= 2+INDEX($A:$A,COLUMN()+<offset>)
Where <offset> is whatever offset you need. The offset will change depending on which column the starting formula is located in.
INDEX should be preferred over INDIRECT because INDIRECT is volatile (must recalculate after any change to the workbook) but INDEX is not (only recalculated when one of the inputs the formula, in this case $A:$A, changes).

Increment numbers starting from Zero in any cell without specific reference in Excel

I want to increment numbers starting from Zero in any cell without specific reference in Excel without VBA. I know to use col()-col($A$1), or a helper column, a1+1, auto-fill options. They all require a reference cell which much be changed if the starting cell is changed. but I have many offset formulae which reference the same ranges but from different cells.
Essentially what I've been unsuccessfully trying to do is have the one formula to paste into any cell, named range or other formula to increment by 1 starting from zero in any cell.
I don't think it should be hard to to, but so far my search has not yielded desired results as per my requirements.(As a last resort - after looking through all the aisles 4 times in every supermarket, twice) I'm asking the question.
What I want is:
0
1
2
3
4...etc. with rows or columns. in any cell without having to reference a absolute cell because I'll have to keep changing that reference with every formula in a different cell.
OFFSET(payments!$E$14,,GCD((COLUMN()-COLUMN('error test'!$B$1))*5),COUNTA(OFFSET(payments!$E$14:$E$522,,GCD((COLUMN()-COLUMN('error test'!$B$1))*5))),1)
(COLUMN()-COLUMN('error test'!$B$1) - this part is just to start at 0 but I have to keep changing the reference $B$1 whenever i put the formula into a different cell or table or pull data from another range. I have many like this, each one has to be carefully examine and changed accordingly to make sure the reference is correct.
Once I added an extra column to my data table, I had to go through every cell and every formula, name ranges, conditional formatting, and change the reference.
Surely there must be a way without using VBA to start counting from zero without needing to manually change a reference every time it moves.
I've tried variations of sum(row()-1+row()), mod, gcd. could there be a way to have an absolute reference move with a cell?
I've just figured it out! i can't believe the answer eluded me for so long!
columns($A$1:a1)-1
This will give me a result of zero, and increments when filled across.
0 1 2 3 ...
rows($A$1:a1)-1 will do the same for rows.
I know it references a cell, but this way it doesn't matter which cell this formula is placed into, the result will always be the same. However if you insert of delete cells, just refill the formula through the desired cells.
I think this will be much easier than column()-column($A$1).
Thanks guys for your help.

trying to expand vlookup to other cells without automatically changing values

I am setting up a vlookup to pull product prices from another sheet within the workbook. The code works for the cell but when i try to expand or copy and past the code into the next row it automatically changes the data table_array value.
=VLOOKUP(B5,Prices!1:65536,3)
Within the code i want the first value, B5 to scale with the row it is in, however the second value needs to remain the same. How do i go about doing this? Also is there a way that i can get the cell to remain blank instead of displaying N/A if there isnt a valid part number?
Thanks for your help!
=VLOOKUP(B5,Prices!$1:$65536,3)
The $ lock the range.
For example.
$A1 will lock the column to A when the formulas is copied other
locations.
A$1 will lock the row
$A$1 will lock both the column and the row.
I can't comment because I do not have enough rep but this will fix user3716271 's formula:
=IF(ISERROR(VLOOKUP(B5,Prices!$1:$65536,3)),"", VLOOKUP(B5,Prices!$1:$65536,3))
The following formula should solve both problems as well, a little more compact and would use one less VLOOKUP():
=IFERROR(VLOOKUP(B5,Prices!$1:$65536,3), "")
As guitarthrower had said, the $ before the number is used to lock the range.
For the second part, an IF formula will work fine:
=IF(ISERROR(VLOOKUP(B5,Prices!1:65536,3)),"",VLOOKUP(B5,Prices!1:65536,3)),"")
And if I understand correctly the first part have you tried set an absolute value? Something like:
=IF(ISERROR(VLOOKUP(B$5,Prices!1:65536,3)),"",VLOOKUP(B5,Prices!1:65536,3)),"")

Change variable horizontally in excel formula

I want to change a variable in an excel formula horizontally and maintain one variable constant.
O3/$C18, P3/$C18, Q3/$C18
I can keep the the bottom variable constant by using the $ symbol but when I want to extend the formula to additional cells, the top variable does not change horizontally, rather vertically.
Thank you for your help. Cheers
The dollar signs in excel "fix" the item to their right
$C18
means C will always be fixed, and 18 can change
C$18 means C can change, but 18 is always fixed.
$C$18 means C is fixed and 18 is fixed (ie always use C18 no matter what direction you drag the cell)
I dont fully understand what you want to do but hopefully the above will help
based on the comments below i think i understand what you mean
try a formula like this
=INDIRECT(ADDRESS(1,ROW()))/$C$18
here address takes the row and column, so row = 1 and column = which ever row you are on (so row1 = A, row2=B etc)
then indirect lets you use that as a reference point
Hope that works
If I understand you correctly, you want to copy your formula vertically, but have the columns update as if you were copying horizontally. For example, you want to copy =O3 to the cell below it as =P3.
For the top, consider the Offset() and Row() functions. Let's say that Cells A1,B1,C1 are 1,2, and 3. Try =OFFSET($A$1,0,ROW()-1). If you copy that formula vertically, the result will be 1, then 2, then 3.
So in your case, try =OFFSET($O$3,0,ROW()-1). It probably needs a little adjustment.
Here's another way to do this:
Start with the formula in this form:
=O$3/$P$18
Copy and paste it across so that you get:
=O$3/$P$18 =P$3/$P$18 =Q$3/$P$18
Copy the two formulas you pasted and select the cell below the first formula.
Then do a Paste Special / Transpose, which can be accessed by right-clicking the selected cell (that is, the one below the first formula that you entered) and then choosing the button that shows a little two-cell range flat and then upright.
Finish up by deleting the formulas in the cells you just copied from.

Resources