If Statement that prompts user

John P

Board Regular
Joined
Oct 17, 2002
Messages
108
Hello,
I would like to write an if statement that prompts the user when the data input into a field is not within the expected range. For example, the result must be within 15% of a given number, if the user inputs a value less than 85% of the number, I want to prompt they are too low and must provide a reason...on the other hand, if they are 115% of the number, I want to prompt that they are too high and need to provide a reason. Is this possible? Any advise is appreciated.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Von Pookie

MrExcel MVP
Joined
Feb 17, 2002
Messages
13,686
Yup, it's possible, but you don't need an IF statement.

Just use Data Validation, under the Data menu.
 

maxflia10

Well-known Member
Joined
May 20, 2002
Messages
890
John,

Elaborating on Kristy's contribution, in the window, there are tabs called "Error Alert" and "Input Message". The error alert lets the user input data not on you list and the input message let's you write your own error message
 

John P

Board Regular
Joined
Oct 17, 2002
Messages
108
Thank you for the prompt responses. Am I limited to the formula I can use? I plugged in >.85*ad4,<1.15*ad4 and the prompt occurs regardless of what I enter for a number.
 

maxflia10

Well-known Member
Joined
May 20, 2002
Messages
890

ADVERTISEMENT

John,

In the Allow window, select decimals and set a min and max value. If these are the only numbers that you want entered, select Stop on the error alert tab.
 

Von Pookie

MrExcel MVP
Joined
Feb 17, 2002
Messages
13,686

ADVERTISEMENT

You may also want to check out the "Custom" option under validation. You can enter formulas there, but I'm not sure how it would work for what you're trying to do.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,934
Messages
5,834,463
Members
430,288
Latest member
Shinoy98

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top