Function Problems

How to Use a Drop-Down Selection to Control a COUNTIF Range in WPS Spreadsheets

Huda QurayshiHuda Qurayshi Nov 13, 2026 868 views

Question details

The user wants to count activity dates for a selected month and activity by using drop-down cells with INDEX and MATCH to dynamically select the appropriate worksheet column.

How to Use a Drop-Down Selection to Control a COUNTIF Range in WPS Spreadsheets
Product
WPS Spreadsheets
Device & OS
not provided
Scenario
A worksheet contains activity dates and activity headers, and the user wants to choose a month and an activity from drop-down cells to count matching records without editing formulas.
Observed behavior
The formula should return the correct count based on the drop-down selections, using the selected activity column and month criteria dynamically.
Before you start

Make sure your data is arranged in a clear range with headers in one row and date values in one column. Also confirm that the drop-down cells contain values that exactly match the header name and the date criterion used in the formula.

Solution 1Recommended

Use INDEX and MATCH Inside COUNTIF to Dynamically Select the Activity Column

Use this when the column to count should change based on a drop-down cell, so the COUNTIF formula updates automatically.

The MATCH function locates the selected activity header in the header row, INDEX returns that column as a range, and COUNTIF counts only the cells matching the criteria. This removes the need to edit formulas each time the selected activity changes.

1
Create drop-down cells for the criteria

In WPS Spreadsheets, select cell D4, go to Data > Data Validation, and create a list of date criteria or activity values. Repeat for cell D5 with the activity header names.

2
Enter the dynamic COUNTIF formula

Click the cell where you want the result and type =COUNTIF(INDEX(A:C,0,MATCH(D5,A1:C1,0)),D4). Press Enter. Adjust A:C and A1:C1 to match your data range and header row.

3
Test the selection

Change D4 and D5 using the drop-down arrows and confirm that the formula recalculates and returns the correct count for the selected activity column.

Use INDEX and MATCH Inside COUNTIF to Dynamically Select the Activity Column
Formula is dynamic: When D4 and D5 exactly match stored values, the range selected by INDEX and MATCH updates without rewriting the COUNTIF formula.
Direct solution in WPS Spreadsheets

Create a Drop-Down-Controlled COUNTIF Formula in WPS Spreadsheets

Use WPS Spreadsheets to build a dynamic COUNTIF formula with drop-down cells, INDEX, and MATCH, then add COUNTIFS date boundaries for accurate month-based counting.

  1. 1. Open the workbook in WPS Spreadsheets: Launch WPS Office and open the workbook that contains your activity dates and headers.
  2. 2. Add drop-down selection cells: Select the criteria cells, go to Data > Data Validation, and choose List to create drop-downs for the month and activity.
  3. 3. Enter the dynamic COUNTIF formula: Click the result cell and enter =COUNTIF(INDEX(A:C,0,MATCH(D5,A1:C1,0)),D4), replacing the ranges with your actual data and header row.
  4. 4. Add date boundaries for month counts: Create start and end date cells for the selected month, then use =COUNTIFS(date_range,">="&start_date,date_range,"<="&end_date,activity_range,D5).
  5. 5. Test and save the spreadsheet: Change the drop-down values to confirm the count updates, then save the file in WPS Spreadsheets or Excel-compatible format.
Dynamically switch the counted column from a drop-down without editing formulasCount selected months and activities accurately with INDEX, MATCH, and COUNTIFSFull compatibility with Microsoft Excel .xlsx, .xls, and .csv filesFamiliar spreadsheet ribbon and formula behavior for a smooth transition from ExcelFree to download and use for personal, school, and business spreadsheets
microsoft office alternative - wps office

Frequently Asked Questions

Why does my dynamic COUNTIF return 0 when a matching activity exists?

The drop-down value must match the header or criterion exactly, including capitalization and any spaces. Check the source list, use TRIM to remove extra spaces, or point the drop-down to the actual header cells.

Can a drop-down select a month and count all dates within that month?

Yes, but use COUNTIFS with start and end date cells instead of matching the month name. A displayed month label is not equal to each individual date in that month.

Does WPS Spreadsheets support Data Validation, INDEX, MATCH, and COUNTIFS?

Yes. WPS Spreadsheets supports these Excel-compatible features, so you can open and edit .xlsx workbooks and use the same formulas without converting.

How do I make the formula update when more data is added?

Convert the data to a table by selecting the range and using Insert > Table, or manually extend the ranges in the INDEX, MATCH, and COUNTIF/COUNTIFS references.

Can multiple formulas use the same drop-down selection cells?

Yes. Point several COUNTIF or COUNTIFS formulas to the same criteria cells, such as D4 and D5, and changing one drop-down updates all connected formulas.