when IF statement is not true....do not change cell

colmullet

New Member
Joined
Jun 25, 2010
Messages
9
Hi Guys,

Was wondering how i make an IF statement only change the value of the cell when the condition is met, and to leave it unchanged when the condition is false.

Thanks in advance.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hi,

You might want to clarify a bit. Are you asking this in vba or in a formula? what is the situation exactly.

AMAS
 
Upvote 0
No Problem,

Its in a formula.

I have a sheet where i have row 1 (1,2,3,4...........)
I then have some analysis where the results change based on which column im looking at which i reference by the number in row 1.

Essentially i want to have an IF statement where IF(reference cell = row1, show result, otherwise do not change cell) so that i can change the reference cell to generate results for different columns and display the results at the bottom of each column......if that makes sense lol

If you need more clarification let me know.
 
Upvote 0
Excel formulas and functions (including IF) do not give instructions to Excel.
They return values.

In short, you can't do this with an Excel formula.
You can do this with a Worksheet_Change event. (VBA)
 
Upvote 0
I just tried something,

if i make the FALSE section of the IF statement equal to the cell im using the IF statement in, then it seems to work, although it does come up with the circular reference error....but is this not what i want? is there anyway to stop this error appearing everytime i change the reference parameter?
 
Upvote 0
No. The circular reference error will come up constantly. Plus, because its an error condition, the result is unreliable.
 
Upvote 0
No. The circular reference error will come up constantly. Plus, because its an error condition, the result is unreliable.

Hi, I had a similar problem where I wanted to keep a history of values from the past by using an If() statement.
I thought I could leave the last parameter blank

if(condition, value if true,)

but that didn't work. then I tried refering the cell to itself, which generated the circular reference warning.

But this caused erroneous behaviour. The next cells which used the result of this history, were giving strange resultes and I thought my spreadsheet was corrupt.

Apparently you need to tell Excel that circular references are okay.

Go File -> options -> Formulas
and check: enable iterative calculations

Then it stopped complaining about the circular references, and it gave more predictable results!

Hooray!
 
Upvote 0

Forum statistics

Threads
1,215,061
Messages
6,122,921
Members
449,094
Latest member
teemeren

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