I want to change the formulas in a 200x200 table by using find and replace.
My old formula is ='Sheet1'!A1*IF(B4=C2,1,0) and I want to replace it with =('Sheet1'!A1-'Sheet1'!B1)*IF(B4=C2,1,0)
Since doing it a cell at a time is tedious, I tried to use find and replace, but I could not keep the referenced cells. Is there a way to do it?
This is how the first cells of my data look like
I cannot fill down or right, since if I fill down I want to keep the reference to C2 while changing the reference to B4 (something like B4-$C$2), while if I fill right I want to keep the reference to B4 and change the reference to C2 (something like $B$4-C2)
I think I might have a bit of a workaround, I'd use it for one cell, and then mess about with the IF references depending on your needs for expanding down and right, as without seeing your dataset it's hard to envisage exactly how you want it, I hope this gives you the right idea, but may need a bit of messing about with.
Firstly, you want to get the cell with your original forumula in (let's say it's in A1). In an empty cell (let's say B1), you want to put =FORMULATEXT(A1). Then in another empty cell (let's say C1), you want to put:
="=(" & MID(B1,2,10) & "-Sheet1!B1" & ")" & MID(B1,11,20)
One thing to also maybe note is that my Excel doesn't produce quotes around the Sheet names, so you may need to mess about with the MID numbers (so probably change the 10 in the first mid to a 12, I think?) I've put the final MID number as 20 just to account for longer formulas.
Copy the cell. Now go to a new worksheet and in A1, you want to right click and paste values. Now, this part is important, you want to click into the formula bar and then press enter. This should now give the formula:
=(Sheet1!A1*-Sheet1!B1)*IF(B4=C2,1,0)
Now you can go into the formula bar, copy this and paste it back into your original sheet. Like I said, you should then mess about with the $ for the IF statement depending on your needs for expanding the data. Sorry it's a bit of a long workaround, but it's all I can find to do!
Related
I want to create a tab that will display all the cell values of another tab based on the tab name provided on a cell.
I have played around with the indirect function, but I cannot write a formula so that by dragging down and right it will access the cells.
=INDIRECT("'"&$A$1&"'!A1")
This part &$A$1& is getting the name of the tab.
If I drag down this formula, the last A1 does not change though.
You can use the formula ="Sheet2!A1" in Sheet1 Cell A1 and drag down, then across. I tried to find a faster way to paste it into every cell, but I had to force quit the application because it used all of my available memory. You might think about whether you actually need every cell to be duplicated into the second sheet. Good luck!
Edit: Just realized you were dead set on using Indirect. This should work.
=INDIRECT("'Sheet2'!"&CELL("address",A1))
Simply use following formula
=INDIRECT($A$1&"!A" & ROW(1:1))
Try building the string like this. The final A1 will work as you want it to.
=INDIRECT(CONCATENATE("'",$A$1,"'!", CELL("address",A1)))
I would like to fill A000001, A000002, till A100000.
Now do it by dragging the fill handle.
I also tried to fill using Step Value and Stop Value. It works for 1,2,3 to 100000. But it does not work for alphanumeric filling like A000001, A000002 etc
Use the step value method to generate 1 to 100000 in column A (from cell A1). And paste the below formula in cell B1,
=IF(LEN(A1)=1,"A00000"&A1,IF(LEN(A1)=2,"A0000"&A1,IF(LEN(A1)=3,"A000"&A1,IF(LEN(A1)=4,"A00"&A1,IF(LEN(A1)=5,"A0"&A1,IF(LEN(A1)=6,"A"&A1))))))
Just double click the fill handle in B1 to generate for the entire range. This is a simpler way of doing this. Hope this helps.
The standard method is Create custom list but since you are looking for a long one so practically impossible,, another is Flash Fill,, and older one is write A000001 in cell A000002 in below cell select both drag it till you need.
I know its too late, however I can provide a tip it may be helpful to someone looking for same issue.
if you want fill the alpha numeric series by dragging the fill handle, just need to add a simple formula in the first row:
="A"&TEXT(ROWS($1:1),"000000")
In the above formula: the text “A” is constant, you can change them to your needed text, and the number “000000” is the variable which will be increased by dragging the fill handle.
Also if you want to add a string at end , you just need to change the formula to this,
="A"&TEXT(ROWS($1:1),"000000")&"-VAL"
Then it will give you something like this,
A000001-VAL, A000002-VAL, A000003-VAL.....
You can also change the starting number too.
Regards
I have a cell number as a string ("A1") in a formula, and this needs to be changed relatively while copying, like it does automatically to normal cell references. so I don't have to visit 400 cells and change them all by hand.
Any way I can manage this? Thanks for the help.
Formula I am using in 400 cells:
=IF(IDENTIC($M$10;"Entries are correct.");IF(ISNUMBER(FIND("A1";$N$5));"S1";IF(ISNUMBER(FIND("A1";$N$6));"S2";IF(ISNUMBER(FIND("A1";$N$7));"S3";IF(ISNUMBER(FIND("A";$N$8));"S4";IF(ISNUMBER(FINDEN("A1";$N$9));"S5";"")))));"")
I don't want to change every single cell as text in all 400 cells, it should change relatively as normal cell references do.
To get a cell reference as a string in Excel you can use the CELL function:
=CELL("address";A1)
Since the second parameter to the function is an actual cell reference, if you copy and paste this formula it will auto-update accordingly.
Bear in mind this will return a string containing an absolute address so it will return "$A$1", not "A1".
CELL(...) will work.
More generally, you can also build the formula as strings using concatenations. This can be useful when you have a list of stuff and you would like to have formulas that refer to those names. Or in your case it would also work.
Building the formula as string with concats & then search & replace
First I build up as much as I can the formula so that the general structure is already formed (only the reference you'll want to change will not be final):
Using your case as an example:
Then, I wrap that nearly-formed formula into a CONCATENATE(). I then arrange things to have a references that I will point to within that CONCAT() that will auto-increment to the text I actually want to include in my formula. Something like this:
=CONCATENATE("IF(FIND(""",A1,"""$A$4),TRUE, FALSE)")
The ,A1, refers to the actual cell, so that cell's content is what will be included in my formula. You can then increment this all the way to build the proper formula for each cell (the 400 ones in your case). You need the triple """ because you want to actually include A1, B1 etc... are text references, not cells.
Then, all you need to do is selected all those formulas, copy them & make sure to choose past as values, say the line under (to keep you concatenate intact so you can edit it later if needed). Then with that pasted line all selected, you use a find & replace to add an "=" sign to the beginning of formulas. Better be too specific on the find & replace, so find "IF(F" and replace by "=IF(F" or similar. Then magic happens:
You can see that A1, C1, D1 have returned TRUE while the rest are #VALUE! because the find method has failed to find the string.
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?
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.