Overwriting a formula in a range with a value, but still keep the formula if value is deleted

pivers

New Member
Joined
Dec 4, 2018
Messages
1
Hi,

I came across this formula which works well, however I would like to be able to apply it to G18:G150 not just to C1. Also I would like to change the formula, =A1, to {=dependency} this new formula should increment as it is copied down.

Dependency = IF(C18="","",IF(G18="Task",MIN(IF(C19:C$87>C18,IF(C19:C$87<c18+1,h19:h$87))),if(and(g18="activity",e18>=1),VLOOKUP(E18,C$17:I$87,7,0)+F18,"")))



Private Sub Worksheet_Change(ByVal Target As Excel.Range)

With Target

If .Address(False, False) = "C1" Then

If IsEmpty(.Value) Then

Application.EnableEvents = False

.Formula = "=A1"

Application.EnableEvents = True

End If

End If

End With

End Sub



Thanks in advance.</c18+1,h19:h$87))),if(and(g18="activity",e18>
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

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