Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Answering Questions in Order.
Written by Allen Wyatt (last updated March 16, 2024)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021
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:
=IF(OR(Q1Response="",Q1Response=Default),Default,Q2Answers)
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 (8386) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Answering Questions in Order.
Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!
When entering data in a worksheet, you may want to exercise some degree of control on the values that can be entered. ...
Discover MoreIf you want to make sure that only unique values are entered in a particular column, you can use the data validation ...
Discover MoreWhen creating a worksheet, you may need to limit what can be entered into a particular cell. Using data validation you ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments