Formula Errors

Excel Formula to Return FAIL When Fewer Than Six Marks Meet a Threshold

Muhammad TalhaMuhammad Talha Oct 28, 2026 869 views

Question details

The user needs a conditional formula to evaluate a range of marks, sum the top scores if conditions are met, and return FAIL if fewer than six marks meet a specific minimum or maximum threshold.

Excel Formula to Return FAIL When Fewer Than Six Marks Meet a Threshold
Product
Excel
Device & OS
not provided
Scenario
Calculating complex student grades or performance scores where a minimum number of qualifying marks is strictly required to pass.
Observed behavior
Requires combining logical functions to accurately count qualifying marks, extract the best values from an array, and output either a text result (FAIL) or the final calculated score.
Before you start

Ensure your data ranges contain actual numeric values and do not contain hidden text strings or error values, as these will interfere with the COUNTIF, LARGE, and SMALL functions.

Solution 1Recommended

Calculate Based on Higher Scores (Minimum Threshold)

Use this formula combination when higher marks are better and a minimum score is required to pass the evaluation.

By nesting the COUNTIF function inside an IF statement, you can verify if the required number of marks exists before performing the final calculation using the SUM and LARGE functions.

1
Select the target cell

Click on the cell where you want the final calculated result or the FAIL text to appear.

2
Enter the logical formula

Type the formula: =IF(COUNTIF(G12:G20,">=39")<6,"FAIL",SUM(LARGE(G12:G20,{1,2,3,4,5}))+G11). Ensure you adjust the range (G12:G20) and the threshold value (39) to match your exact grading criteria.

3
Execute the formula

Press the Enter key. If fewer than six marks in the specified range are 39 or higher, the cell will display FAIL. Otherwise, it will sum the top 5 marks from the array and add the value from cell G11.

Calculate Based on Higher Scores (Minimum Threshold)
Understanding the Array Constant: The section {1,2,3,4,5} acts as an array constant, prompting the LARGE function to extract the 1st, 2nd, 3rd, 4th, and 5th highest values simultaneously so the SUM function can add them together.

Calculate Complex Conditional Formulas Easily with WPS Spreadsheet

WPS Spreadsheet provides robust support for advanced array functions, statistical formulas, and logical operations, allowing you to build complex grading and threshold calculators with ease.

  1. 1. Open your dataset: Launch WPS Spreadsheet and open the workbook containing your scoring data.
  2. 2. Input the formula: Select the target cell and type your combined IF and COUNTIF formula using the top formula bar.
  3. 3. Drag to fill: If you are calculating this for multiple subjects or students, click and hold the fill handle at the bottom-right of the cell, then drag downward to automatically apply the formula to other rows.
Fully compatible with Microsoft Excel formulas, including array functions like LARGE and SMALL.Advanced syntax highlighting to easily track and modify cell references.Free to use with a lightweight, intuitive interface.Built-in formula error checking to quickly debug nested IF statements.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my LARGE function return a #NUM! error?

The #NUM! error occurs in the LARGE or SMALL function if the specified array is completely empty, or if you request a position (like the 5th value) that is greater than the total number of data points available in your range.

Can I adjust the formula to sum exactly 6 marks directly from the array?

Yes, if you want to sum the top 6 marks directly from the range without adding an external cell (like G11), change the array constant to sum six items: SUM(LARGE(G12:G20,{1,2,3,4,5,6})).

How does the array constant {1,2,3,4,5} work in this formula?

The array constant enclosed in curly brackets forces the LARGE or SMALL function to return an array of multiple specific positions (the 1st through 5th highest or lowest values). The SUM function wrapper then adds all these extracted values together into a single total.

Is there a way to make the pass threshold dynamic instead of hardcoding it?

Yes, you can reference another cell containing your threshold limit. Instead of typing ">=39" inside the COUNTIF function, use ">="&A1, where cell A1 contains the numeric threshold value you want to test against.