As we all know Microsoft Excel is used to collect data in rows and columns. Sometimes, we want to restrict to only certain data to be in the sheet. We want to throw an error, when someone is trying to enter data against the validation. For example, if you want to set the restriction in such way that, a particular cell in Excel should only accept text of 10 characters in length, then you can specify the validation for that cell in Excel easily.
Whenever anyone enters text beyond the restriction, you can show the error message explaining the validation. In this article I will let you know how to create or add error messages in Excel.
First, select the cell (E6 in our example) which you want to set the restriction. Click on the Data tab and under Data Tools section, click Data Validation.
In Data Validation dialog box, click on Settings tab. In the Allow drop-down, you can specify what data is allowed in the cell. It can be a whole number, Date, Decimal or even custom formula can be added.
In our case, as we need to set the restriction for more than 10 characters, select Text Length. If you do not want to throw an error for empty cell, then check Ignore blank check-box.
Now, in Data drop-down, select the operator. In our case, I selected between.
As we have chosen ‘between’, we need to specify Minimum and Maximum range. We can either select the cell range or enter the values directly. For our case, enter ‘1’ in Minimum and ‘10’ in Maximum.
Now, click on the Input Message tab. This tab is used to specify the message to be shown when the cell is selected and for that check Show input message when cell is selected. Specify the Title and Message to be shown when the cell is selected. Title is shown in bold and the message is shown as normal text below the title.
Now, it is the time to create the Error Message in Excel. Click on Error Alert tab. Check the option “Show error alert after invalid data is entered” to avoid error message being shown for every data entered in the cell.
In Style dropdown, select the error type to be shown. It can be Stop, Warning or Information. Enter the Title and Error Message to be shown in the error pop up. Click “OK” and your validation has been set for the selected cell in Excel.
When you enter the text which has less than 10 characters, then no error message is shown. But, when you enter the text more than 10 characters beyond our restriction, then error message is shown as below.
You could see that the title and message you set is shown in the error message. It is suggested to have the meaningful title and message which explains the validation and restriction.
This is the easiest way to create error messages in Excel.