Function Problems

How to Calculate Module Averages with AVERAGEIF and Wildcards in Excel

Emma BrownEmma Brown Oct 23, 2026 869 views

Question details

The user needs to calculate average grades grouped by modules, where column headers use a module-chapter naming pattern (e.g., 1-1, 1-3).

How to Calculate Module Averages with AVERAGEIF and Wildcards
Product
Spreadsheet
Device & OS
not provided
Scenario
A teacher or data analyst wants to average student grades dynamically based on specific module prefixes found in the column headers.
Observed behavior
Requires a formula that evaluates header strings to match a specific module number using wildcards, and then averages the corresponding values in a data row.
Before you start

Ensure your dataset has distinct headers containing the module-chapter pattern (like '1-1' or '2-10') and that the grades within the rows are stored as numerical values, not text.

Solution 1Recommended

Use AVERAGEIF with a Wildcard Criterion

Concatenate the target module number with a wildcard (asterisk) to average all columns belonging to that specific module.

The AVERAGEIF function can match partial text strings by using wildcards. By referencing a cell that contains your target module number and joining it with an asterisk, the formula will locate all headers starting with that module number.

1
Set up your target module number

Type the module number you want to average into a reference cell, for example, J2.

2
Select the output cell

Click on the cell where you want the calculated average to appear for the first student.

3
Enter the AVERAGEIF formula

Type the formula =AVERAGEIF($C$2:$I$2, $J$2&"-*", C3:I3) and press Enter. This tells the system to look at the header row (C2:I2), find items starting with the J2 value plus a hyphen, and average the student's grades in row 3.

4
Copy the formula

Drag the fill handle (the small square at the bottom right of the cell) downwards to calculate the average for the rest of the students.

Use AVERAGEIF with a Wildcard Criterion
Formula Breakdown: The expression $J$2&"-*" uses the ampersand (&) to join the module number with a hyphen and an asterisk. The asterisk acts as a wildcard, standing in for any subsequent characters (like the chapter numbers).
Efficient Data Calculation in WPS Spreadsheet

Use WPS Spreadsheet to Effortlessly Calculate Conditional Averages

WPS Spreadsheet fully supports advanced functions like AVERAGEIF with wildcards, making it incredibly easy to group and calculate grades or process massive datasets quickly and accurately.

  1. 1. Open your dataset: Launch WPS Spreadsheet and open the document containing your student grades and module headers.
  2. 2. Select the destination cell: Click the cell where you want the calculated average to be displayed.
  3. 3. Input the formula: Type =AVERAGEIF(, select your header row range, add your wildcard parameter (e.g., J2&"-*"), select the row containing the student's grades, and press Enter.
  4. 4. Apply to all rows: Hover over the bottom-right corner of the active cell and drag the fill handle down to calculate the averages for your entire student roster instantly.
Fully compatible with Microsoft Excel formulas, including AVERAGEIF, wildcards, and complex cell referencing.Lightweight architecture ensures smooth performance even with thousands of rows of grading data.Intuitive drag-and-fill features streamline repetitive data processing tasks.Completely free access to professional spreadsheet tools and templates.
microsoft office alternative - wps office

Frequently Asked Questions

Why is my AVERAGEIF formula returning a #DIV/0! error?

This error occurs if no cells meet the wildcard criteria, or if the cells that do meet the criteria are empty or contain non-numeric text. Double-check your header spelling and ensure the grades are formatted as numbers.

Can I use multiple criteria to calculate an average?

Yes. If you need to evaluate multiple conditions (such as specific module prefixes AND a grade greater than zero), you should use the AVERAGEIFS function, which allows for multiple criteria ranges and conditions.

Do wildcards work with pure numbers in AVERAGEIF?

Wildcards in AVERAGEIF function correctly only with text strings. If your headers are formatted strictly as numbers without any text elements (like hyphens), wildcard criteria will not evaluate them correctly. Ensure your labels contain text components or are formatted as text.