If Statement - replacing two cells

techgirl

Board Regular
Joined
Sep 16, 2002
Messages
178
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I need to know how to use an If statement for the following scenario...
If A1 = 0, the replace the entries in C1 and E1 with 0.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Here is the section of VBA code to do that.
Code:
If Range("A1")=0 Then
    Range("C1")=0
    Range("E1")=0
End If
 
Upvote 0
A formula can not replace the contents of other cells.
If there are formulas in C1 and E1, you can incorporate this into the formula. If so, please post these formulas, if not you will need VBA.
 
Upvote 0
You cannot store both a value and a cell in the same cell in Excel, and Excel formulas can only update values in the cells they are found in (they cannot update other cells directly).

So you either need to use VBA, or re-think how you want to do this.
 
Upvote 0
You would have to have in Cells C1 and E1 a formula!
Like in cell C1:
=IF(A1=0,0,other condition)

Michael
 
Upvote 0
I need to know how to use an If statement for the following scenario...
If A1 = 0, the replace the entries in C1 and E1 with 0.
Do C1 and E1 have formulas already? If so, then: =IF(A1=0,0,your current formula)
If C1 and E1 and hard-typed entries, then I agree with the others
 
Upvote 0
C1 and E1 had nothing in them. I have added the following in each cell and worked great.

C1 =IF(A1=0,0,A1*B1)
E1 =IF(C1=0,0,C1+D1)

Thanks so much!
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,733
Members
448,987
Latest member
marion_davis

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