Equation Replacement

poleary2000

Active Member
Joined
Apr 1, 2002
Messages
354
I have the following equation:

=IF('Activity List'!H6>0,'Activity List'!H6,"")

It is copied down for 20k records. However, multiple rows were also manually deleted. There may have been 1k rows deleted. Thus, the equations look like this:

=IF('Activity List'!H6>0,'Activity List'!H6,"")
=IF('Activity List'!H6>0,'Activity List'!H7,"")
=IF('Activity List'!H6>0,'Activity List'!H10,"")
=IF('Activity List'!H6>0,'Activity List'!H11,"")

I need to change the equation to:

=IF(ISNUMBER('Activity List'!H6)=TRUE,'Activity List'!H6,"")

That is easy, but I can't just fill it down because of all the rows the person manually deleted. So, I'd like to replace the equation -- but can't figure out how to do it. Any thoughts?
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Select the entire range that contains the formulae in question, and then run the following code (you might want to amend it to set calculation to manual)

Code:
Sub Replacement()
Dim r As Range

Application.ScreenUpdating = False

For Each r In Selection

    If r.HasFormula = True Then r.Formula = Replace(r.Formula, "'Activity List'!H6>0", "ISNUMBER('Activity List'!H6)=TRUE")

Next r

Application.ScreenUpdating = True

End Sub
 
Upvote 0
That helps, but I should have been more clear. I need each equation to be different all the way down. Like:

=IF(ISNUMBER('Activity List'!H6)=TRUE,'Activity List'!H6,"")
=IF(ISNUMBER('Activity List'!H6)=TRUE,'Activity List'!H7,"")
=IF(ISNUMBER('Activity List'!H6)=TRUE,'Activity List'!H10,"")
=IF(ISNUMBER('Activity List'!H6)=TRUE,'Activity List'!H11,"")

Basically, whatever cell is being reference now with the bad equation...I need to be referenced with the good equation.
 
Upvote 0
Why not just find and replace

'Activity List'!H6>0

with

ISNUMBER('Activity List'!H6)

(The =TRUE part is redundant)
 
Upvote 0
OK, didn't realize I didn't need the true. But how do I replace that for each different cell reference. That method works for one cell.
 
Upvote 0
Did you try the code?
Actually, why not just use Find & Replace?

I tried the code. It replaces only the one cell with the new equation, because each subsequent cell might be H7 or h2091 or h21873.

Can you use Find and Replace to replace items on both sides of the H#? I can't figure out how to get rid of the >0 and also add the ISNUMBER prior.

Not sure if I am being clear enough here.
 
Upvote 0
I need to convert this:

=IF('Activity List'!H6>0,'Activity List'!H6,"")
=IF('Activity List'!H7>0,'Activity List'!H7,"")
=IF('Activity List'!H10>0,'Activity List'!H10,"")
=IF('Activity List'!H11>0,'Activity List'!H11,"")


To this:

=IF(ISNUMBER('Activity List'!H6)=TRUE,'Activity List'!H6,"")
=IF(ISNUMBER('Activity List'!H7)=TRUE,'Activity List'!H7,"")
=IF(ISNUMBER('Activity List'!H10)=TRUE,'Activity List'!H10,"")
=IF(ISNUMBER('Activity List'!H11)=TRUE,'Activity List'!H11,"")

But there are more than 4 equations. This could go on for 20k records. Sorry for the confusion, I think I posted incorrectly above.
 
Upvote 0
Thus, the equations look like this:

=IF('Activity List'!H6>0,'Activity List'!H6,"")
=IF('Activity List'!H6>0,'Activity List'!H7,"")
=IF('Activity List'!H6>0,'Activity List'!H10,"")
=IF('Activity List'!H6>0,'Activity List'!H11,"")
That doesn't sound to me what the equations look like, then.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,291
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top