Drag down and change value of formula - excel

I have this formula:
=IF(INDIRECT("summary!a2")="","",INDIRECT("summary!a2"))
.. this will retrieve the value of the a2 cell in the summary sheet.
What i want to know is what can i do on this formula to allow the value a2 to change to a3/a4/a5 etc.. when dragged down the sheet .
Can anyone give me a hint here?
Thanks

Try: =IF(INDIRECT("summary!a"&ROW(A2))="","",INDIRECT("summary!a"&ROW(A2))) - applicable for drag down)

If you use CELL function you can also drag down and across, e.g.
=INDIRECT("Sheet2!"&CELL("address",A1))

Related

Excel formula to make cell read-only

I'm trying to find a formula to make an Excel cell read-only based on criteria.
For example - if A2 is empty, make B2 and C2 read-only.
I haven't been able to find any examples of this. Can anyone help out?
That is not possible with a formula. Where would you want to put it? Not in A2 (here's the original data or empty), not in B2 or C2, here's where you might want to put new data.
You may put a warning symbol in a different cell, e.g. D2. Or, as suggested, you might want to use Data Validation on B2 and C2 to prevent them from receiving new input, if A2 is empty: Data Validation -> Custom -> Formula =NOT(ISEMPTY(A2)) and uncheck the "Igonre empty cells" option.
Anyway, this does not prevent you from eratsing B2 and C2 if A2 is empty. So for perfection, a VBA solution would be necessary.

Fixed excel formula (not depending on moving cell)

In D2 cell I have a formula referring to D4 cell value.
Then, I drag&drop D4 cell from D4 to C4, and my D2 cell formula changed.
How to "hardcode" this marked reference to D4 (resulting in 0*2=0)?
Is it possible to make it work without vba?
Try this.
=indirect(address(4,4))*2
Use absolute reference like..
=$D$4*2
Since you aren't doing a vlookup to reference the data (Which is the problem I'm having), try using an INDEX with the limits of excel's table of cells as the braces to prevent it from moving, like this:
=(INDEX($1:$1048576,4,4))*2
That prevents the reference from moving. =D

Excel drag-formula not working

I have a "subscription" column in column A. A1 is "12000". I want C1 to be "A1/12" AND D1 to be "A1/12". However, if I make the formula for C1 "A1/12" and then drag to the right, D1 will try to become "B1/12" which I DO NOT WANT.
I do not just want to make A1 a constant, because I want that when I copy and paste this onto the following rows, C2 and D2 should be "A2/12" and NOT "A1/12".
Thoughts? Sorry for the obfuscated explanation.
Just lock the cell. This is done with dollar signs, or when you put the reference, press F4.
=$A$1/12
And you can drag it without the formula changing the A1.
If you want it to change with changing rows, just lock the column A:
=$A1/12
Use the dollar sign to fix the reference:
=$A$1/12
You might want to have a look at this for more information
http://www.notjustnumbers.co.uk/2011/05/excel-tip-dollar-sign-in-formula-fixing.html

Using a SUMIF and Drag down formula and change COLUMN references instead of ROWS

I have this forumula on Sheet1 in Cell A1:
=SUMIF(Sheet2!$F:$F,L$11,Sheet2!$L:$L)
As I drag this down to A2,A3, etc... However I need the $L:$L to move across columns as I drag down to reference $M:$M in A2 and $N:$N in A3... etc.
Please Help! I've tried the indirect, index, and offset and have not been able to get anything to work successfully.
Thanks!
Give the following a try in A1 and drag it down.
=SUMIF(Sheet2!$F:$F,L$11,OFFSET(Sheet2!$L:$L,0,row()-1))

Excel VBA select column refence cell formula

I would like to do the following:
Worksheets("Sheet1").Columns("A2").Select
Where in A2 I have the following formula:
=WEEKNUM(NOW())
The formula can be merged probably.
The reference to cell A2 doesn't work.
Worksheets("Sheet1").Columns(Worksheets("Sheet1").Cells(2, 1).Value).Select
worked for me,... I think you just needed one more level of indirection to dig the value out of A2.

Resources