Data Validation


Data Validation Interview with follow-up questions

1. Can you explain what data validation in Excel is and why it's important?

Data validation is a feature in Excel that controls what a user can enter into a cell or range. You define rules, and Excel either prevents invalid input or warns the user when the rules are violated.

Why it matters:

  • Prevents errors at the source: stops users from entering text where a number is expected, or a date outside an allowed range — before the bad data pollutes downstream calculations.
  • Improves consistency: enforcing a drop-down list ensures values like "North", "South", "East", "West" are never entered as "north", "NORTH", or "Nroth".
  • Guides users: input messages (tooltips) can explain what is expected when a cell is selected; error alerts explain what went wrong when an invalid entry is attempted.
  • Reduces cleaning work: clean data coming in means less time spent on TRIM, PROPER, and IF-based workarounds later.

What you can validate:

  • Whole numbers within a range
  • Decimal numbers with min/max bounds
  • Date or time within a specific period
  • Text of a specific length
  • Values from a predefined list (drop-down)
  • Custom formula-based rules (e.g., prevent duplicates, require a specific prefix)

Where to find it: Data tab > Data Tools group > Data Validation.

Interview tip: Interviewers often ask why data validation is preferable to fixing data after entry. The answer is that validation is preventive — it is always cheaper to stop bad data at entry than to detect and clean it later, especially in shared workbooks where many people contribute data.

↑ Back to top

Follow-up 1

Can you provide an example of when you would use data validation?

One example of when you would use data validation is when you have a spreadsheet that tracks employee information, including their age. You can use data validation to set a rule that only allows ages between 18 and 65 to be entered. This helps to ensure that incorrect or invalid ages are not entered into the spreadsheet.

Follow-up 2

What are some common types of data validation in Excel?

Some common types of data validation in Excel include:

  • Whole Number: Allows only whole numbers to be entered.
  • Decimal: Allows only decimal numbers to be entered.
  • List: Allows only values from a predefined list to be entered.
  • Date: Allows only dates to be entered.
  • Text Length: Allows only text of a certain length to be entered.
  • Custom Formula: Allows you to create a custom formula to validate the data.

Follow-up 3

How would you handle errors when using data validation?

When using data validation, you can handle errors by displaying an error message when invalid data is entered. This can be done by setting up an error alert that appears when the user tries to enter invalid data. The error alert can provide a custom error message and give the user the option to retry or cancel the data entry. Additionally, you can also choose to show an error icon next to the cell with invalid data to visually indicate the error.

2. How would you set up a drop-down list using data validation in Excel?

A drop-down list restricts a cell to only the values you specify, reducing input errors and improving consistency.

Steps to create a drop-down list:

  1. Select the cell or range where you want the drop-down to appear (e.g., D2:D100).
  2. Go to the Data tab > Data Tools group > click Data Validation.
  3. In the Settings tab, set Allow to List.
  4. In the Source field, enter your list values one of two ways:
    • Typed directly: North,South,East,West (comma-separated, no spaces around commas on Windows; semicolons on some regional settings)
    • Cell range reference: =$G$1:$G$4 — points to a range containing the list values. This is the preferred approach because you can update the list in one place and all drop-downs refresh automatically.
  5. Make sure In-cell dropdown is checked (it is by default).
  6. Optionally configure the Input Message tab (tooltip when cell is selected) and Error Alert tab (message shown when a user types something not in the list).
  7. Click OK.

Using a named range as the source (best practice):

Define a named range for your list values (Formulas > Name Manager or just type a name in the Name Box and press Enter). Then use the name in the Source field: =RegionList. This makes the validation rule readable and maintainable.

Dynamic drop-downs (Excel 365):

Source the list from a UNIQUE or FILTER formula result. Because UNIQUE spills dynamically, reference the spill range with #: =UniqueRegions# — the drop-down automatically updates as source data changes.

Dependent drop-downs: Use INDIRECT in the source field to create a drop-down whose options depend on the value selected in another cell — a common advanced interview follow-up.

↑ Back to top

Follow-up 1

What are the benefits of using a drop-down list in Excel?

Using a drop-down list in Excel offers several benefits:

  1. Data consistency: By limiting the available options to a predefined list, you can ensure that users enter valid and consistent data.
  2. Efficiency: Drop-down lists make data entry faster and more efficient by providing a list of options to choose from, rather than requiring manual entry.
  3. Error prevention: With a drop-down list, you can prevent users from entering incorrect or misspelled values.
  4. Data validation: Drop-down lists can be used in combination with data validation rules to enforce specific data entry requirements.
  5. Easy updates: If you need to update the list of options in a drop-down list, you can simply modify the 'Source' field in the data validation settings, and the changes will be reflected in all cells with the drop-down list.

Follow-up 2

How would you handle errors when setting up a drop-down list?

When setting up a drop-down list in Excel, you may encounter errors. Here are some common errors and how to handle them:

  1. Invalid data: If you enter invalid data in the 'Source' field of the data validation settings, such as a misspelled value or a value that is not separated by commas, Excel will display an error message. To fix this, double-check the values in the 'Source' field and make sure they are correct.
  2. Overlapping ranges: If you try to set up a drop-down list in a cell or range of cells that already contains data, Excel will display an error message. To fix this, either select a different cell or range, or clear the existing data before setting up the drop-down list.
  3. Inconsistent data: If you have multiple drop-down lists in different cells or ranges, make sure that the 'Source' fields for each drop-down list contain the same set of values. Inconsistent data in the 'Source' fields can lead to unexpected behavior.

Follow-up 3

Can you update a drop-down list once it's been created? If so, how?

Yes, you can update a drop-down list in Excel once it's been created. To update a drop-down list, follow these steps:

  1. Select the cell or range of cells with the drop-down list.
  2. Go to the Data tab in the Excel ribbon.
  3. Click on the Data Validation button.
  4. In the Data Validation dialog box, make the necessary changes to the 'Source' field.
  5. Click OK.

The drop-down list will be updated with the new values specified in the 'Source' field. Note that any existing data in the drop-down list will not be affected by the update.

3. How can you use data validation to restrict the type of data entered into a cell?

Data validation lets you restrict a cell to accept only a specific type of data, preventing users from entering the wrong kind of value entirely.

Steps:

  1. Select the cell or range to validate.
  2. Go to Data tab > Data Validation.
  3. On the Settings tab, choose the data type from the Allow dropdown:
Allow option What it restricts to
Whole number Integers only, with optional min/max
Decimal Numbers including decimals, with optional bounds
List Values from a predefined list (drop-down)
Date Dates within a specified range
Time Times within a specified range
Text length Entries of a specific character count
Custom Any formula that returns TRUE/FALSE
  1. Set the condition (e.g., for Whole number: between 1 and 100).
  2. Optionally add an Input Message (appears as a tooltip when the cell is selected) and an Error Alert (appears when invalid data is entered — choose Stop to block it, Warning to allow it with a prompt, or Information to just notify).
  3. Click OK.

Example — accept only dates in the current year:

Set Allow to Date, Data to between, Start date to =DATE(YEAR(TODAY()),1,1), End date to =DATE(YEAR(TODAY()),12,31).

Custom formula example — accept only positive numbers:

Set Allow to Custom, Formula: =A1>0.

Tip: Use the Stop error alert style for critical fields where bad data would cause calculation failures. Use Warning for advisory checks where a user might legitimately need to override the rule.

↑ Back to top

Follow-up 1

What types of data can you restrict with data validation?

With data validation, you can restrict various types of data in Excel, including:

  1. Whole numbers: You can specify a range of whole numbers that are allowed in a cell.
  2. Decimals: You can set the number of decimal places and specify a range of decimal values.
  3. Dates and times: You can restrict the input to specific date or time formats and define a range of valid dates or times.
  4. Text length: You can limit the number of characters that can be entered in a cell.
  5. Custom validation: You can create custom formulas to validate data based on specific conditions.

These are just a few examples, and there are many other types of data validation criteria available in Excel.

Follow-up 2

Can you provide an example of when you would want to restrict the type of data entered into a cell?

Sure! Let's say you have a spreadsheet where you track the number of hours worked by employees. In this case, you would want to restrict the type of data entered into the 'Hours Worked' column to only accept whole numbers. By using data validation, you can ensure that only valid whole numbers are entered, preventing any accidental input of decimals or non-numeric characters.

Here's an example of how you can set up data validation for the 'Hours Worked' column:

  1. Select the cells in the 'Hours Worked' column where you want to apply data validation.
  2. Go to the 'Data' tab in the Excel ribbon and click on 'Data Validation' in the 'Data Tools' group.
  3. In the 'Data Validation' dialog box, choose 'Whole number' as the validation criteria.
  4. Set the minimum and maximum values to 0 and any desired upper limit, such as 24 for a maximum of 24 hours.
  5. Optionally, you can provide an input message and error alert to guide users when entering data.
  6. Click 'OK' to apply the data validation.

Now, users will only be able to enter whole numbers within the specified range in the 'Hours Worked' column.

Follow-up 3

How would you handle errors when restricting data types?

When restricting data types with data validation, you can handle errors by setting up an error alert that appears when users enter invalid data. The error alert can provide a customized message to guide users and prevent them from entering incorrect data.

Here's how you can handle errors when restricting data types:

  1. Select the cells with data validation applied.
  2. Go to the 'Data' tab in the Excel ribbon and click on 'Data Validation' in the 'Data Tools' group.
  3. In the 'Data Validation' dialog box, go to the 'Error Alert' tab.
  4. Choose the style of error alert you want to display, such as 'Stop', 'Warning', or 'Information'.
  5. Enter a title and error message that will be shown when invalid data is entered.
  6. Optionally, you can choose to show an input message to provide additional guidance.
  7. Click 'OK' to apply the error alert.

When users enter data that violates the data validation criteria, the error alert will be displayed, preventing them from proceeding until valid data is entered.

4. Can you use data validation to restrict the range of values entered into a cell?

Yes — data validation is commonly used to restrict numeric values to a specific range, ensuring users enter only acceptable numbers.

Steps:

  1. Select the cell or range to validate.
  2. Go to Data tab > Data Validation.
  3. In the Allow dropdown, choose Whole number (integers only) or Decimal (any number).
  4. In the Data dropdown, choose the condition:
    • between — value must fall within a min and max
    • not between — value must fall outside a range
    • equal to / not equal to / greater than / less than / greater than or equal to / less than or equal to — single-bound comparisons
  5. Enter the boundary values. These can be literal numbers or cell references (e.g., =$B$1 lets you control the limit from another cell without editing the validation rule).
  6. Optionally add an Input Message and Error Alert.
  7. Click OK.

Example — allow only percentages between 0 and 100:

  • Allow: Decimal
  • Data: between
  • Minimum: 0
  • Maximum: 100

Dynamic bounds using cell references:

Setting Minimum to =$C$1 and Maximum to =$D$1 means the allowed range updates automatically when C1 or D1 changes — no need to reopen the validation dialog.

Custom formula for more complex range logic:

If you need a range that is not a simple between/greater-than rule, use Custom with a formula. For example, to ensure the value is at least twice the value in B2: =A1>=B2*2.

↑ Back to top

Follow-up 1

How would you set up this type of restriction?

To set up a restriction on the range of values entered into a cell, you can follow these steps:

  1. Select the cell or range of cells where you want to apply the restriction.
  2. Go to the 'Data' tab in the Excel ribbon.
  3. Click on 'Data Validation' in the 'Data Tools' group.
  4. In the 'Data Validation' dialog box, choose the 'Settings' tab.
  5. In the 'Allow' dropdown menu, select 'Whole number', 'Decimal', 'List', or any other appropriate option based on the type of restriction you want to apply.
  6. Configure the other options such as minimum and maximum values, input message, and error alert as needed.
  7. Click 'OK' to apply the data validation restriction.

Once the restriction is set up, users will only be able to enter values within the specified range.

Follow-up 2

Can you provide an example of when you would want to restrict the range of values entered into a cell?

Sure! One example of when you would want to restrict the range of values entered into a cell is when you have a cell that should only accept positive numbers. By setting up a data validation restriction with a minimum value of 0, you can ensure that users cannot enter negative numbers or zero into that cell.

Follow-up 3

What happens if a user tries to enter a value outside of the specified range?

If a user tries to enter a value outside of the specified range, Excel will display an error message and prevent the user from entering the invalid value. The error message can be customized to provide instructions or explanations to the user. The user will need to enter a value within the specified range in order to proceed.

5. How can you use data validation to check for duplicate entries in a column?

Data validation with a custom formula is the standard way to prevent duplicate entries in a column.

Steps:

  1. Select the range where you want to prevent duplicates — for example, A2:A100 (leave A1 as a header).
  2. Go to Data tab > Data Validation.
  3. In Allow, choose Custom.
  4. In the Formula field, enter:
=COUNTIF($A$2:$A$100, A2)=1

This counts how many times the value in the current cell (A2) appears in the entire range. The rule allows entry only when the count equals 1 (meaning the value is unique).

  1. On the Error Alert tab, set Style to Stop, and write a message like "This value already exists in the list."
  2. Click OK.

How it works: When a user types a value, Excel evaluates the COUNTIF formula against the full range. If the value appears more than once (count > 1), the validation fails and the Stop alert blocks the entry.

Important note about order of evaluation: Data validation checks the value after it would be entered, so the formula correctly catches whether the new entry creates a duplicate — even if the value does not yet exist in the range when the user starts typing.

Alternative for finding existing duplicates (not prevention): If you want to highlight duplicates already in a column rather than prevent future ones, use Conditional Formatting > Highlight Cells Rules > Duplicate Values — this is simpler for retrospective checking.

Excel 365 alternative: =COUNTIF($A$2:$A$100, A2)=1 remains the standard approach. For very large ranges, UNIQUE and FILTER functions can be used to audit duplicates outside the validation context.

↑ Back to top

Follow-up 1

Can you walk me through the steps to set this up?

Sure! Here are the steps to set up data validation to check for duplicate entries in a column:

  1. Select the range of cells where you want to apply the data validation.
  2. Go to the 'Data' tab in the Excel ribbon.
  3. Click on 'Data Validation' in the 'Data Tools' group.
  4. In the 'Data Validation' dialog box, select 'Custom' from the 'Allow' dropdown.
  5. In the 'Formula' field, enter the formula to check for duplicates. For example, if you want to check for duplicates in column A, you can use the formula '=COUNTIF($A$1:$A$10,A1)>1'. This formula counts the number of occurrences of the value in A1:A10 and returns 'TRUE' if there are more than one occurrence.
  6. Optionally, you can set an error message and error alert style to display when a duplicate value is entered.
  7. Click 'OK' to apply the data validation.

Once the data validation is set up, it will prevent users from entering duplicate values in the specified range of cells.

Follow-up 2

What happens if a user tries to enter a duplicate value?

If a user tries to enter a duplicate value in a cell that has data validation set up to check for duplicates, Excel will display an error message and prevent the user from entering the duplicate value. The specific error message and behavior can be customized when setting up the data validation. By default, Excel will display a generic error message like 'The value you entered is not valid. A user has restricted values that can be entered into this cell.'

Follow-up 3

How would you handle errors when checking for duplicates?

When checking for duplicates using data validation in Excel, you can handle errors by customizing the error message and error alert style. Here are the steps to handle errors:

  1. Select the range of cells where you have applied the data validation.
  2. Go to the 'Data' tab in the Excel ribbon.
  3. Click on 'Data Validation' in the 'Data Tools' group.
  4. In the 'Data Validation' dialog box, you can customize the error message in the 'Error message' tab. You can provide a specific error message that explains why the duplicate value is not allowed.
  5. You can also customize the error alert style in the 'Error alert' tab. You can choose to display a warning, information, or stop style.
  6. Click 'OK' to apply the changes.

By customizing the error message and error alert style, you can provide clear instructions to the user and control how Excel handles errors when checking for duplicates.

Live mock interview

Mock interview: Data Validation

Intermediate ~5 min Your own free AI key

Your voice and your AI key never touch our servers; the key stays in this browser and is sent only to Google. Only your round scores are saved to track progress.