top of page

You are learning Error Handling in MS Excel

How to create custom error messages for specific scenarios?

Excel offers two main methods for creating custom error messages for specific scenarios:

1. Data Validation with Error Alert:

This method is ideal for scenarios where you want to restrict the type of data users can enter into a cell.

Here's how it works:

* Select the cell(s): Choose the cell(s) where you want to restrict data entry and display a custom error message.
* Data Validation: Go to the "Data" tab and navigate to the "Data Tools" group. Click on "Data Validation."
* Set Up Criteria: In the "Settings" tab, define the criteria for allowed data using options like "Allow," "Criteria," and "Data source."
* Error Alert Tab: Switch to the "Error Alert" tab. Here, you can customize the message displayed when users enter invalid data.
* Title & Error message: Enter a clear and informative title for your message in the "Title" box. In the "Error message" box, type your custom message explaining the error and what kind of data is expected.
* Stop or Inform: Choose whether the error message should "Stop" users from entering invalid data or simply "Inform" them.
* OK: Click "OK" to save your settings and activate the data validation with your custom error message.

2. Conditional Formatting with Input Message:

This method allows you to display a custom message based on the format of the entered data. It's more flexible than data validation as it doesn't restrict data entry but provides visual cues and informative messages.

Here's the process:

* Select the cell(s): Choose the cell(s) where you want to display the custom message based on formatting.
* Conditional Formatting: Go to the "Home" tab and find the "Conditional Formatting" section. Click the dropdown arrow and choose "New Rule."
* Format Values Where: In the "New Formatting Rule" window, select "Format values where this formula is true" under "Select a Rule Type."
* Formula for Formatting: Enter a formula that evaluates the cell content. For example, to check for negative numbers, you could use the formula `A1<0`. (Replace A1 with your actual cell reference).
* Format with: Define the formatting you want to apply when the formula is true (e.g., red font color).
* Format > Cell Notes: Click on the "Format" button and go to the "Cell Notes" tab.
* Input Message & Show Input Message when selected: Enter your custom message in the "Input message" box. Check the "Show input message when selected" box.
* OK: Click "OK" on all open windows to save your conditional formatting rule with the custom input message.

Choosing the Right Method:

- Use Data Validation with Error Alert when you want to strictly control data entry and prevent invalid data from being entered.
- Use Conditional Formatting with Input Message when you want to provide informative messages and visual cues based on the format of the entered data, offering flexibility without restricting input.

bottom of page