Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to apply AutoFilter to the data range A1:D10.
Excel
ActiveSheet.Range("A1:D10").[1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Filter' instead of 'AutoFilter' causes an error.
Using 'Sort' does not apply filtering.
✗ Incorrect
The AutoFilter method applies filtering to the specified range.
2fill in blank
mediumComplete the code to filter the first column for cells equal to "Apple".
Excel
ActiveSheet.Range("A1:D10").AutoFilter Field:=1, Criteria1:=[1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around the criteria causes a syntax error.
Using single quotes instead of double quotes is incorrect.
✗ Incorrect
The criteria must be a string enclosed in double quotes.
3fill in blank
hardFix the error in the code to filter column 2 for values greater than 100.
Excel
ActiveSheet.Range("A1:D10").AutoFilter Field:=2, Criteria1:=[1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using >100 without quotes causes an error.
Using just 100 filters for equal to 100, not greater than.
✗ Incorrect
The criteria must be a string with the operator and number inside quotes.
4fill in blank
hardFill both blanks to filter column 3 for values between 50 and 200.
Excel
ActiveSheet.Range("A1:D10").AutoFilter Field:=3, Criteria1:=[1], Criteria2:="<=200", Operator:=[2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using xlOr instead of xlAnd combines criteria incorrectly.
Not quoting the criteria strings causes errors.
✗ Incorrect
Use Criteria1 for the lower bound and Operator xlAnd to combine with Criteria2.
5fill in blank
hardFill both blanks to filter column 3 for values between 50 and 200 using Criteria1 and Criteria2.
Excel
ActiveSheet.Range("A1:D10").AutoFilter Field:=3, Criteria1:=[1], Operator:=xlAnd, Criteria2:=[2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using numeric values without quotes causes errors.
Mixing up Criteria1 and Criteria2 values.
✗ Incorrect
Criteria1 is the lower bound >=50, Criteria2 is the upper bound <=200, Operator xlAnd combines them.