Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier 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 February 17, 2020)


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. Follow these steps if you are using Excel 2010 or a later version:

  1. Display the File tab of the ribbon and then click Options. Excel displays the Excel Options dialog box.
  2. At the left side of the dialog box, choose Formulas. (See Figure 1.)
  3. Figure 1. The Formulas tab of the Excel Options dialog box.

  4. Make sure the Enable Iterative Calculation check box is selected.
  5. Click OK.

If you are using Excel 2007, 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."


If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8264) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. You can find a version of this tip for the older menu interface of Excel 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. ...


Using Correct Apostrophes

Word does a pretty good job of figuring out what apostrophes to use around your text. There may be times, however, when ...

Discover More

Find and Replace in a Column or Row

Need to search for information in a table? Word allows you to easily limit your search to an entire column or row, as ...

Discover More

Moving Object Anchors

When you insert an object into your document, it is anchored to a paragraph. If you want to change the paragraph to which ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (ribbon)

Cleaning Text

You can use the CLEAN worksheet function to remove any non-printable characters from a cell. This can come in handy when ...

Discover More

Finding the Lowest Numbers

Need to find the lowest numbers in a range of values? It's easy to do using the SMALL worksheet function, or you can use ...

Discover More

Using the IRR Function

When working with finances, you often need to know the rate of return on a given investment. The most common type of ...

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 6Mpixels. 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 two more than 5?

2020-03-06 15:59:26


This doesn't work. At least in Office 2019.

2020-02-21 04:54:30


Rw Col A Col B
1 === ABC
2 123
3 === ABC
4 234
5 === ABC
6 345

i just wanted to fill Blank Cell of Col B with "===" if cell in Col A is not "===" or you may say cell in Col A has some numeric value otherwise retain the old value or no change in cell of Col B. When I put a formula in Cell B2 that if(A2<>"===", "===", B2), it works fine. But when I put the same formula in Cell B3 that if(A3<>"===", "===", B3), it resulted in Cell B3 value as 0 instead of "ABC". Kindly suggest the formula (i dont want to use Macro). Though it can be achieved through selectiing all blank Cells in Col B and then replaced it by "===" but I wish to use it through formula so that process may be automated.


2019-02-05 06:39:58


Hi Allen / All,

Got excited when I seen this link hoping it could fix my problem, and I think it's on the right track.

The code I'm working with is -

=IF($A2=TODAY(),COUNTIF(Table21[JOB ROLE],"Ad-min"),0)

$A2 obviously relates to a date and I want the formula to return a count from a separate table if Ad-min is featured on the list. but I don't want to lose the information the following day (I want to produce a monthly line graph from the data) when the whole formula becomes false and 0 is returned.

any help would be appreciated.........

2018-10-21 01:26:22


Hi Allen,

This macro is genius!! The result is exactly what I have been searching for.
I am attempting to use this macro. I have a few questions:

1.) The macro will not read the value of my array (YES). It will only work if I hard enter YES in the cell.
How do I use this macro with an array?

2.) The macro is set to apply to one row. How do I make this macro applicable to the entire column? For example, if I enter YES in D2 result displays in E2, entry in D3, entry displays in E3 etc.?

In my workbook D2= {=INDEX(SHEET1!B:B,MATCH(SHEET2!B2&SHEET2!C2,SHEET1!Y:Y&SHEET1!Z:Z,0))}

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("D2")) _
Is Nothing) Then
If Range("D2") = "YES" Then
Range("E2") = NOW()
End If
End If
End Sub

2018-08-16 08:22:39


Hi Allen,

Q: how do I create two formulas in once cell for the following:
1 gp 5 % 1%
2 2,703.22 81.10 ?

if column B contains a value , then column C must show zero.
But if column B contains no value, then column C must show a value of the % x the value in column A
(C will =R27.03 (R2 703.22 x 1%) only if B shows no value)
(C will = R0.00 only if B show a value of R81.10)

2018-08-06 05:28:17


Hi Allen,
Thank you firstly. I tried the solution you posed in excel 2016, but it didnt work.

Actually, I put the formula like '=if(and(H$6>$B$3, H$6<$C$4), "T", H7)' or '=if(and(H$6>$B$3, H$6<$C$4), "T", H$7)' to the cell H7. Before that, some text had been filled into the cells from H7 to Z7. However, when I drag the cross from H7 to Z7, all cells was filled with "T" eventhough the 'iteration computation' had been opened in the 'option'. So could you please help me to solve that problem? Many Thanks.

2018-05-14 22:34:18


thank you so much for this.. worked exactly how I wanted..!!

2018-04-04 02:55:46

Steve Jez

This should do what you want



2018-04-03 11:50:48


Q. How do I return the same value in D4 that is in C4 if the condition is not met (the formula is in D4). eg.If C4 is greater than or equal to 20 then I want D4 to show "20", but if C4 is less then 20, then I want D4 to return the same value that you see in C4 . ( C4 = 35, D4 =20)(C4=16,D4=16).

total load # 1 load # 2 load # 3
86 42
53 20
20 13
total 175 75 0 0


2016-11-02 07:47:18

Gary Coleman

Say you have the original data in Column A. The easiest way around the if statement not returning the original value for false is to just have a duplicate column. So create a column B that is equal to column A. Then in Column C do the if statement, using column B, but for the false criteria, use the values from column A to avoid circular reference. If you don't like seeing two identical columns side by side, then move column A to another sheet and hide the sheet.

2016-02-02 17:45:24



I have a similar just more complex issue, I would like to create the circular ref that puts but the current value of a cell. But I all ready have a false value that I need(as I don't want the amount appearing in the future months). I only want the amount from K9 to change for the current month and leave the month/s before what it was.

I've been trying nested IF and AND statements but can't seem to get it right.


2016-01-24 06:43:26


Good Day,
Mr. Allen Wyatt,

Thanks for your help. I have one question. What to do if one have to retain different values in multiple column and rows (Cell's own value)?




with unlimited rows

2015-12-22 05:12:38

Felipe FAG

Right formula


If false do nothing (a1<>b1)

do nothing and keep the old value.


2015-12-22 05:08:42

Felipe FAG

This formula will be a VBA.


2015-12-22 05:07:31

Felipe FAG

I need a help.

I'm need to add a formula:

If false do nothing and keep the old value in the cell.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu 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.