Fix Excel VBA AutoFilter Criteria for Formatted Numbers
Question details
The user needs to filter numeric values reliably in Excel VBA when their displayed number format differs from the criterion.

- Product
- Microsoft Excel VBA AutoFilter
- Device & OS
- not provided
- Scenario
- A VBA macro filters a column containing a number such as 1000 that is displayed as 1,000 or 1000.00.
- Observed behavior
- The filter may return no matching rows for 1000 even though a matching formatted value is visible.
Check whether the target cells contain numbers or text, and note the exact displayed format. Identify the filter range and the target column's position within that range.
Use Equal Lower and Upper Numeric Filter Criteria
Use a numeric range when an exact criterion does not match the formatted display.
Setting the lower and upper bounds to the same value targets that numeric value without relying on a single displayed-text criterion.
In Excel, open Developer > Visual Basic, then open the module containing your filter macro.
Use a range criterion, for example: Dim FilterValue As Double: FilterValue = 1000 ActiveSheet.Range("A1:D100").AutoFilter Field:=1, Criteria1:=">=" & FilterValue, Operator:=xlAnd, Criteria2:="<=" & FilterValue
Replace A1:D100 with your data range, including its header row, and set Field to the target column's position within that range. Run the macro from Developer > Macros and check the visible rows.

Filter by the Displayed Value or Use a Helper Column
Try the displayed format for a quick match, or use a consistently formatted helper column when values vary.
Work with Formatted Numbers in WPS Spreadsheets
WPS Office is a free, lightweight Office alternative with a familiar interface for working with spreadsheet data. Open compatible Excel files and migrate everyday spreadsheet work with ease; it does not fix Excel's VBA AutoFilter behavior.

Frequently Asked Questions
Why does filtering for 1000 return no rows when I can see 1,000?
Excel may interpret the criterion differently from the displayed value. Try the displayed value in the filter dropdown or use equal numeric lower and upper bounds in VBA.
What does Field mean in the AutoFilter VBA command?
Field is the target column's position within the specified filter range. For Range("A1:D100"), Field:=1 filters column A and Field:=2 filters column B.
Will equal numeric bounds match values displayed as 1,000 after rounding?
Not necessarily. Criteria of >=1000 and <=1000 target the underlying value 1000, so a different value rounded to look like 1,000 may not match.
How can I filter numbers stored as text?
Create a helper column with =IFERROR(VALUE(A2),""), fill it down, and check that the results are numeric. Apply the filter to the helper column.




