How to change a function/formula in a whole column where I also have empty cells

Posted by Zvi on Super User See other posts from Super User or by Zvi
Published on 2011-02-14T10:51:32Z Indexed on 2011/02/14 23:27 UTC
Read the original article Hit count: 306

I have a column with a formula/function that has other cells as parameters. However in the column, every few rows I have a subtotal and blanks, for readability. Now I decided to change the formula/function but I can not do copy+paste on the whole column because of the subtotals/blank cells, and I can not do change+replace because there are parameters in the functions that uses other cells and thus it is different in each cell in the column.

For example, if the formula is =if(A5>24,1,"") and I want to change it to =AA_userfn(A5,B5)

Any idea how to change it easily? currently I copy+paste few rows at a time, but that is tedious.

Maybe a Sub that will go all over the column (the column number as an input parameter) and looks for =if(, and then replaces it with =aa_userfn(Ax, By) where Ax and By are calculated based on the position of the cell currently changed in reference to the previous values in that cell.

Any ideas will be welcomed

© Super User or respective owner

Related posts about excel-2007

Related posts about find-and-replace