Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Leaving a Cell Value Unchanged If a Condition Is False.

Leaving a Cell Value Unchanged If a Condition Is False

by Allen Wyatt
(last updated October 18, 2014)


While using the IF function, Vineet wants to retain the old value in the cell if the condition is false. In other words, the value in a cell where the IF function is used should change only if the condition being tested by the IF function is true. By default, however, the IF function makes the value 0 if the condition is False.

The IF function can take up to three parameters. The first parameter is the comparison that is to be made, the second parameter is what should be returned if the comparison is true, and the third is what should be returned if the comparison is false. It is possible to leave off the last parameter, but if you do then Excel will return the value 0 if the comparison is false. (This is what Vineet is seeing returned by his IF function usage.)

The obvious solution, then, is to make sure that you provide the IF function with something that should be returned when the comparison is false. For instance, let's say that your formula is in cell B1 and you are comparing something in cell A1. The formula you use may look like this:

=IF(A1<10,"under ten",B1)

Note that the words "under ten" are returned if the value in A1 is less than 10. If this condition is not met, then the value in B1 is returned. Since this formula is in cell B1, this means that the previous value in the cell is returned if the condition is false.

It also means that the formula contains a circular reference. For circular references to work OK you need to let Excel know that it is OK for them to occur in your worksheet. Choose Tools | Options | Calculation tab and make sure the Iteration check box is selected. Excel will now allow the circular reference without complaint.

If you don't want to allow a circular reference in your worksheet, then the only recourse is to create a macro that updates the value in cell B1 based upon any changes to cell A1:

Private Sub Workbook_SheetChange(ByVal Sh As Object, _
  ByVal Target As Range)

    ' See if the change is related to our cell
    If Not (Application.Intersect(Target, Range("A1")) _
      Is Nothing) Then
        If Range("A1") < 10 Then
            Range("B1") = "under ten"
        End If
    End If
End Sub

This simple macro, when added to the ThisWorkbook module, is executed every time there is a change in the workbook. If the value is cell A1 is changed (and only that cell), then the value is checked to see if it is less than 10. If it is, then the value in cell B1 is changed. If it isn't, then the value in cell B1 is left alone.

There is one "gottcha" that you need to keep in mind with any of the approaches discussed thus far, formula or macro. If the value in cell A1 is (let's say) 15, then cell B1 will contain what was there before, whatever it was. If you change the value in cell A1 to (let's say) 7, then B1 will change to "under ten." That's fine, but from that point on cell B1 will never appear to change. Why? Because if you then change cell A1 to a value greater than 10, cell B1 will contain (as just explained) what was there before. And, as you now understand, the value that was there before is the result of the previous true result, which was "under ten." Thus, true or false, the formula or macro from this point on displays the text "under ten."

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8260) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Leaving a Cell Value Unchanged If a Condition Is False.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...


Inserting the Subject in Your Document

One of the properties you can specify for a document is a subject. You can then use a field code to insert this subject, ...

Discover More

Extracting URLs from Hyperlinks

When you add a hyperlink to a worksheet, it consists of a minimum of two parts: display text and URL address. If you have a ...

Discover More

Word 2007 Terrific Tables (Table of Contents)

Word allows you to create and format tabular information using a powerful table editor. Discover the many ways that you can ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (menu)

Nesting IF Worksheet Functions

The IF worksheet function is very handy to make conditional evaluations. You are not limited to a single IF comparison, ...

Discover More

Using the IF Worksheet Function

Programmers know that a staple of any language is the ability to create conditional statements. Excel understands this, as ...

Discover More

Colors in an IF Function

You can use the IF worksheet function to test for a number of different conditions or values. You can't use it to check for ...

Discover More

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 8Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 0 + 7?

2017-06-19 15:51:55

Molly Williamson

Hi, I'd like to know how to leave the cell BLANK if the value in the IF function is false.


2017-04-10 04:11:34


1 - 18.13434 2 7.000

2 - 18.13436 90 358.000

Need help on this one. If B2 is grater than 10, revert back to 10 but if B2 is smaller than 10 - keep B2 unchanged.

2016-10-12 09:15:01



Is it possible to have a function change a cell value to another cells' value according to the current date, but not have it change if the return argument is false?

like: if(WEEKDAY(TODAY)=x,CellA= CellB, Do nothing).

I'm not to great at writing my own functions but I had this in mind as well

Public Function checkCell()
x As Integer
If x = Weekday(TODAY()) Then
cell = cell
cell = "do nothing"
End If
End Function

If possible,
Please and thank you.

2016-03-03 01:46:49


I have this formula to calculate percentage based on daily activity (filled manually) and come with today percentage ('E11'!$E$5)


the problem is when the results showed on the calender table; lets say today is 3/mar/2016, the percentage showed is today percentage lets say 50% (it is working), but when 4/mar/2016 come the percentage of 3/mar/2016 will changed to 0% instade of 50%. how i can keep the result of today on the box when i am moving to the next day.

This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.