assignment of Class 6: Data Validation and Conditional Formatting

Rashmi Mishra

Class 6: Data Validation and Conditional Formatting

Assignment Examples

Assignment 1: Implement Data Validation

Task: In a spreadsheet, apply data validation to allow only dates in the current month to be entered in the "Date of Sale" column (A1

).

Solution:

  1. Select A1

.

  1. Go to Data Validation.
  2. Set the validation criteria as Date and select "between" the start and end dates of the current month.
  3. Set an error message that says, "Please enter a valid date within this month."

Assignment 2: Highlight Top Performers

Task: Use conditional formatting to highlight the top 3 performers in a list of students' scores.

Solution:

  1. Select the range of students' scores.
  2. Go to Conditional Formatting > Top/Bottom Rules > Top 10 Items.
  3. Change the number to 3, and select a fill color (e.g., green) to highlight the top 3 scores.

Assignment 3: Apply Color Scales

Task: Use color scales to differentiate between low, medium, and high salaries in a dataset.

Solution:

  1. Select the salary data range.
  2. Go to Conditional Formatting > Color Scales.
  3. Choose a 3-color scale (e.g., red for low, yellow for medium, green for high salaries).

Assignment 1: Data Validation - Drop-Down List for Employee Department

Task: Create a drop-down list for employee departments (Sales, HR, IT, Finance) in cells A2:A10.

Steps:

  1. Select the Range:
    • Highlight cells A2:A10 (where you want the drop-down list).
  2. Open Data Validation:
    • Go to the Data tab in Excel or Google Sheets, then click Data Validation.
  3. Set the Criteria:
    • In the Allow field (Excel) or Criteria field (Google Sheets), select List.
    • In the source field, type the values: Sales, HR, IT, Finance.
  4. Click OK:
    • After entering the values, click OK. Now, each cell in the range A2:A10 will have a drop-down list where users can select one of the departments.

Solution:

After applying these steps, you should be able to choose from the list of departments in each cell of the selected range.


Assignment 2: Data Validation - Restrict Age to Between 18 and 60

Task: Set up a rule to allow only ages between 18 and 60 in the range B2:B10 (where you will enter employee ages).

Steps:

  1. Select the Range:
    • Highlight cells B2:B10.
  2. Open Data Validation:
    • Go to Data > Data Validation.
  3. Set the Validation Rule:
    • In the Allow field, select Whole Number (Excel) or Number (Google Sheets).
    • Set the Minimum to 18 and Maximum to 60.
  4. Set an Error Alert:
    • Choose a custom error alert (optional). For example, display an error message: "Please enter an age between 18 and 60."
  5. Click OK:
    • After applying these settings, you’ll only be able to enter ages between 18 and 60 in cells B2:B10.

Solution:

Any number outside the range 18–60 will trigger an error message, ensuring only valid ages are entered.


Assignment 3: Conditional Formatting - Highlight Sales Above Target

Task: Highlight all sales amounts greater than $10,000 in the range C2:C10 using conditional formatting.

Steps:

  1. Select the Range:
    • Highlight cells C2:C10 (which contain the sales data).
  2. Open Conditional Formatting:
    • Go to the Home tab (Excel) or Format menu (Google Sheets), and click Conditional Formatting.
  3. Set the Rule:
    • Choose Highlight Cells Rules > Greater Than (Excel), or Greater than (Google Sheets).
    • In the box, enter 10000.
  4. Choose Formatting Style:
    • Set the format (e.g., a light green fill or bold text).
  5. Click OK:
    • Now, all sales greater than $10,000 will be highlighted with the selected format.

Solution:

Cells containing sales data greater than $10,000 will be highlighted, making it easy to identify high-performing sales.


Assignment 4: Conditional Formatting - Apply Data Bars to Revenue

Task: Apply data bars to visually represent monthly revenue in the range D2:D12.

Steps:

  1. Select the Range:
    • Highlight cells D2:D12 (where monthly revenue is listed).
  2. Open Conditional Formatting:
    • Go to Conditional Formatting (Excel) or Format > Conditional Formatting (Google Sheets).
  3. Choose Data Bars:
    • In Excel, select Data Bars from the menu.
    • In Google Sheets, use a custom number format or select Color Scale to simulate data bars.
  4. Choose Bar Color and Style:
    • Pick a color for the bars (e.g., blue). You can also adjust whether the bars are gradient-filled or solid.
  5. Click OK:
    • The data bars will now appear, with longer bars representing higher revenue.

Solution:

The data bars will display inside the cells, visually indicating the relative value of each cell’s revenue data.


Assignment 5: Conditional Formatting - Color Scale for Exam Scores

Task: Use a color scale to show exam scores (in the range E2:E12) where high scores are green and low scores are red.

Steps:

  1. Select the Range:
    • Highlight cells E2:E12 (which contain the exam scores).
  2. Open Conditional Formatting:
    • Go to Conditional Formatting > Color Scales.
  3. Choose a Color Scale:
    • Select a 3-color scale:
      • Green for the highest values.
      • Yellow for middle-range scores.
      • Red for the lowest scores.
  4. Click OK:
    • The scores will now be color-coded, with green indicating high performance and red indicating low performance.

Solution:

This scale will allow you to quickly assess the distribution of scores, visually indicating who performed well and who did not.


Assignment 6: Data Validation with Custom Error Message

Task: Create a data validation rule that restricts the entry in the "Order Quantity" column (range F2:F10) to values between 1 and 50. Display a custom error message if an invalid entry is made.

Steps:

  1. Select the Range:
    • Highlight cells F2:F10.
  2. Open Data Validation:
    • Go to Data > Data Validation.
  3. Set Validation Criteria:
    • Choose Whole Number (Excel) or Number (Google Sheets) and set the minimum value as 1 and the maximum as 50.
  4. Set Custom Error Alert:
    • Enable the Error Alert option and set the message to: "Please enter a valid quantity between 1 and 50."
  5. Click OK:
    • If a user tries to enter a number outside the specified range, they will receive the custom error message.

Solution:

By applying this, only quantities between 1 and 50 can be entered. Invalid entries will prompt an alert with your custom message.


Assignment 7: Conditional Formatting - Highlight Duplicate Entries

Task: Identify and highlight any duplicate entries in the "Employee ID" column (G2:G15).

Steps:

  1. Select the Range:
    • Highlight cells G2:G15 (where employee IDs are listed).
  2. Open Conditional Formatting:
    • Go to Conditional Formatting > Highlight Cells Rules > Duplicate Values.
  3. Set Formatting Style:
    • Choose how you want duplicates to be highlighted (e.g., with red text or a light red fill).
  4. Click OK:
    • Any duplicate employee IDs in the range will be highlighted.

Solution:

All duplicate values in the selected range will be highlighted, making them easy to spot.


Conclusion:

These assignments cover practical applications of Data Validation and Conditional Formatting, helping you gain a deeper understanding of how to control data input and visualize information in a spreadsheet. Each task is designed to reinforce key concepts through real-world scenarios.