I'm currently working on a massive file, that compares year/year data.
Every week I need to update a formula in the file to move down a row. I want to make a command button to update these formulas.
Here is a simple example
cell c800 contains: =((C235-C229)/C229)*100
I would like to click the button to make the cell update to
=((C236-C330)/C330)*100
Can anyone help me out here? is this possible? I've been looking all over for this and can't find anything.
thanks
Enter this formula in C800 and it will always capture any newly added lines of data.
=(INDEX(C5:C799,MATCH(1E+99,C5:C779,1))-INDEX(C5:C799,MATCH(1E+99,C5:C779,1)-6))/INDEX(C5:C799,MATCH(1E+99,C5:C779,1)-6)*100
assumes first data point is in C5. Change as needed
This works because MATCH(1E+99,C5:C799,-1) finds the last numerical value in the column.
there is a function to do that, as if the cell containing the formula was copied somewhere else and the cell references in the formula were shifted/moved:
strFormulaMoved$ = Application.ConvertFormula(Application.ConvertFormula(Selection.Formula, XlReferenceStyle.xlA1, XlReferenceStyle.xlR1C1, , Range("C800")), XlReferenceStyle.xlR1C1, XlReferenceStyle.xlA1, , Range("C800").Offset(1, 0))
Related
I have the following formula set-up: =INDIRECT("'Passed to Salesforce (digital only)'!A46",TRUE)
However I'd like the A46 number to update when I drag the formula down.
I've tried using the &CELL but can't get it to quite work:
=INDIRECT("'Passed to Salesforce (digital only)'!A46""!"&CELL("address",TRUE))
Can anyone help me out?
Thanks,
Sam
I have no idea what you're trying to do in your second formula.
The first one won't change the reference because it is just text not an actual cell reference. If you only want to update the row, not the column you could use ROW() to get the current cell's row add an offset (e.g. if you start with your formula in row 1 and want A46 your offset is 45):
=INDIRECT("'Sheet1'!A"&ROW()+45,TRUE)
I figured this out, I had to remove the first cell reference and duplicate exclamation mark:
=INDIRECT("'Passed to Salesforce (digital only)'!"&CELL("address", A47))
I was wondering if it is possible to create a formula that updates a cell that needs to update based on both numbers and letters or would I need to create a code in VBA. What I need now is for the following values to update when the information is entered in to a designated cell:
If AA0 is entered in cell A1, then AA1 should populate in cell A2, (I would like to use AA0 all the way through AA9, and then go to AB0, which would then go to AC0 when AB9 is entered, and then if AZ9 is entered go to BA0 (I am hoping I am making since) when any of those values are entered in the cell. I had tremendous help on here before for a similar question but this involves all three digits/numbers in the cell as a determining factor and I am struggling with a formula for it. Thank you all in advance for any assistance.
Edited to add: Everything would just be entered into one cell. So if someone entered in A1 BC4, A2 would update to BC5. I wouldn't need a running list, this is to keep track of what the previous value used was.
Edit 2 adding photos for clarity:
If you always start at AA0 put this in the first cell and copy down:
=LEFT(ADDRESS(1,INT((ROW(1:1)-1)/10)+27,4),2)&MOD(ROW(1:1)-1,10)
If you want the start to be dynamic then put this in A2 and copy down:
=IF(AND(MID(A1,2,1) = "Z",RIGHT(A1)="9"),CHAR(CODE(LEFT(A1))+1),LEFT(A1))&IF(AND(MID(A1,2,1) = "Z",RIGHT(A1)="9"),"A",IF(RIGHT(A1)="9",CHAR(CODE(MID(A1,2,1))+1),MID(A1,2,1)))&IF(RIGHT(A1)="9","0",RIGHT(A1)+1)
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)),"")
I'm struggling with a problem here. I'm sure it's so simples, that's why I can't find the answer.
I need to apply this to Sheet1!C4:C22:
=(RANDBETWEEN(1.45*100,1.95*100)/100)+Sheet2!C12
Problem is: I've tried Fill tool && select the range Sheet1!C4:C22, paste the formula in the bar and hit ctrl+enter but here lies the problem: excel keeps changing the cell on the formula, as it goes down the column. I don't want that! How can I stop it doing that without copy paste by hand? I know it's not a lot of columns, but it's handy.
P.S: Sheet2!C12 contains a fixed value of 0.056.
If you want to use a constant range when dragging a formula down then add $ dollar signs before the letter and number
example
Sheet1!$C$12
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.