I have over 1500 rows of information with formulas such as, ='3'!$AH$6 , where each column contains information from another sheet within the workbook. In the example, the sheet labeled '3' is referenced. Is there a way to change only the reference to another sheet for all 1500 rows at one time? For example change the formula to ='4'!$AH$6. I only need to change the reference to another sheet as the cell references will stay the same. I hope this makes sense, thanks for any help.
Excel – How to change a single character in an excel formula for 1500 rows
microsoft excel
Related Solutions
Sadly, the use of the volatile INDIRECT
and OFFSET
are almost ubiquitously recommended in such cases on the various Excel sites around, even though there exists a perfectly good, minimally volatile (in fact, volatile "at workbook open" only, as I understand) set-up using INDEX
.
To determine the last non-empty row in a column, column A say, it will be useful to know the datatype of the entries within that column, and also whether there are any null strings ("") present.
Although there are set-ups available which will work whatever the datatype of the entries in question, they are necessarily of a type such that they must process each element within the range passed to them. As such - and particularly if the range over which it is necessary to calculate is quite large - they can be extremely resource-heavy (the second suggestion by kyle being a good example, having to process more than a million cells, irrespective of whether the last non-empty cell is in row 1 or row 1048576).
It is also worthwhile storing the value of the last non-empty row as a Defined Name, LRow say.
The possible definitions for LRow are then as follows:
1) If there are no null strings and all entries are non-numerical, you can define LRow as:
=MATCH("Ω",A:A)
2) If there are no null strings and all entries are numerical, you can define LRow as:
=MATCH(9.9E+307,A:A)
3) If there are no null strings and entries are of a mixed datatype, i.e. some numerical, some non-numerical, you can define LRow as:
=MAX(MATCH("Ω",A:A),MATCH(9.9E+307,A:A))
If there are null strings within the range then the solutions become necessarily more complex, and it is no longer possible to avoid a construction in which each cell within the array is processed individually. As such, the best we can do is to minimize the range which we pass to be processed.
Hence, we have:
4) If there are null strings, you can define LRow as:
=MATCH(1,0/(LEN(A1:INDEX(A:A,MAX(MATCH("Ω",A:A),MATCH(9.9E+307,A:A))))>0))
(You could of course make this even more efficient if the datatype is consistently numerical or non-numerical, as above.)
which requires array-entry (CSE) and which, in general, will vastly reduce the range being processed, especially compared to something such as:
=MATCH(1,0/(LEN(A:A)>0))
which is disastrous in terms of efficiency.
Note that the additional functions within the former are of very little detriment: it is far more important to reduce the number of cells being processed than to worry about an additional function call or two.
You can now use this within an INDEX
construction to dynamically define your range. For example:
=A1:INDEX(A:A,LRow)
which, as mentioned, is barely volatile at all.
Regards
Best Answer
There are several ways to do this
Use VBA » ALT+F11 to insert and ALT+F8 to execute this little macro
This has the benefit that you can insert even invalid references (e.g. the reference will be there only on another PC or in the future) without a update data dialog for every cell
If you want, you can select single columns with
columns("A:A")
instead ofusedrange
Use Excel find & replace function » CTRL+H and search in formulas.
Select your columns you want to alter before you open the dialog