Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.
With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company.
Learn more about Allen...
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.
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.
Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!