Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to change #DIV/0! error to the readable message in excel?

Sometimes, when we use the formula to calculate in excel, some error messages will display. For example, in this formula =A1/B1, if B1 is empty or contains 0, the formula will display a #DIV/0 error. Is there any way to make those error messages clearly readable or if you want to use other messages to replace the errors, what should you do?

doc-excel-change-error-message-1 -2 doc-excel-change-error-message-2

Here, I am going to introduce you some methods to replace error messages.

Change error values with VBA code

Change error values with Kutools for Excel


arrow blue right bubble Change error values with VBA code


If you have a range of cells which contain some formula error values, and now you need to convert all the error values to some readable messages, such as 0. The following VBA code can help you, please do as this:

1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module Window.

VBA code: change error values to some readable messages

Sub ReplaceErrors()
'Update 20131216
Dim Rng As Range
Dim WorkRng As Range
Dim ReplaceStr As String
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
ReplaceStr = Application.InputBox("Replace text", xTitleId, Type:=2)
Set WorkRng = WorkRng.SpecialCells(xlCellTypeFormulas, 16)
WorkRng.Value = ReplaceStr
End Sub

3. Then press F5 key to run this code, and a prompt box will pop out to tell you select a range that you want to use. See screenshot:

doc-excel-change-error-message-3

4. And then click OK, another box will appear, please input the values into the text box that you want to replace the errors. See screenshot:

doc-excel-change-error-message-4

5. Click OK and all the error values have been replaced with the value you need.

doc-excel-change-error-message-5

Note: This VBA code will change all error values (not just DIV/0 error) to your needed messages.


arrow blue right bubble Change error values with Kutools for Excel

If you are not familiar with the above code, using the advanced tool- Error condition wizard of the Kutools for Excel to achieve them quickly and conveniently.

The multifunction of Error Condition Wizard of Kutools for Excel:

1). Change any types of error condition (#N/A, #VALUE!, #REF!, #DIV/0!,#NUM!, #NAME?, or #NULL! ) to 0, blank cell, customized text, etc.;

2). Change only the #N/A error to 0, blank cell, customized text, etc.;

3). Change any error messages except #N/A error to 0, blank cell, customized text, etc..

Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 30 days. Get it Now.

After installing Kutools for Excel, please do as following steps:

1. Click Kutools > More Tools > Error Condition Wizard, see screenshot:

doc-excel-change-error-message-6

2. In the Error Condition Wizard dialog box, do the following options:

  • (1.) Clickdco-button1 button to select the range that you want to change the errors;
  • (2.) Specify the error types from the drop down list, you can select Any error value, Only the #N/A error value or Any error value except #N/A;
  • (3.) Specify the content or messages you would like to use for replacing error messages under Error display section, in this example, I replace the errors with the value “null”.

doc-excel-change-error-message-7

3. After finishing the settings, click OK, all the error values have been replaced with your entered message. See screenshots:

doc-excel-change-error-message-1 -2 doc-excel-change-error-message-8

Click to know more about this Error Condition Wizard.


Related article:

Search and replace # formula errors with 0 or blank cells in Excel?


Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.