Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Answering Questions in Order.
by Allen Wyatt
(last updated December 28, 2013)
Kim created a form in Excel that relies upon data validation to present answers using drop-down lists. There are a series of questions in the form. He wonders if there is a way to force the questions to be answered in order. He would like, for instance, for the user to answer question 1 before going to question 2, etc.
Accomplishing this sort of task may scream out for using a macro or creating a user form, but you don't need to go this route. (Using macros and user forms are very powerful, but they are also more complex than some people may want.) You can get a level of "orderliness" by simply adjusting the specifications you use in your data validation drop-down lists.
As an example, you'll want to set up a few named ranges in your workbook. Pick a cell and name it "Default". In that cell put a default message, such as the text "Answer questions in order." In another named range (perhaps named "Q1Answers") you would include the list of acceptable answers for your first question. Finally, you should assign a name to the cell that will contain the user's answer to the question, such as "Q1Response." You could create similar named ranges for the other acceptable answers and responses to your other questions (Q2Answers, Q3Answers, Q2Response, etc.).
Then, in your validation check for each of your questions you can use a formula to specify what Excel should use as the possible answers. In this scenario the validation settings for question 1 are easy; just set the Allow setting to List and specify (in the Source box) that you want to use the Q1Answers range used. For subsequent questions, however, you should use a formula in the Source box. For instance, for question 2 you should use the following formula in the Source box:
For each subsequent question you would change the Q1 designation to whatever is appropriate for the previous question and change the Q2 designation to whatever is appropriate for the current question. The formula works because it specifies that if the response to question 1 is empty or it is equal to the Default value ("Answer questions in order"), then the Default answer is displayed as the choice for question 2. If neither of those conditions exist, then the responses for question 2 are displayed and selectable. If people try to answer the questions when an earlier question has not been answered, the only drop-down option visible will be the Default value ("Answer questions in order").
You can take this approach one step further, if you want, by adding conditional formatting to the mix. If you use the same sort of testing (to see if the previous question was answered), you could modify the formatting of the cells containing your questions. For instance, if the previous question has not been answered, then simply format the later questions so that they appear as white type. That makes them disappear into the white background of the cell. Then, as each question is answered, the next question would seem to appear, in order.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8384) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Answering Questions in Order.
Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!
When setting up Excel for data entry, you often have to be concerned with what values are acceptable. For example, if users ...Discover More
When using data validation, you might want to have Excel display a message when someone starts to enter information into a ...Discover More
Want to control what users put into a cell? It's easy to do using a feature called data validation, as described in this tip.Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."