Skip to content
Free Excel Tutorials
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Data Analysis

  • Reverse List in Excel
  • How to create a Histogram in Excel
  • Remove Duplicates Example in Excel
  • Filter Data Based on Date in Excel
  • Error Bars in Excel

References

  • Convert text string to valid reference in Excel using Indirect function
  • How to create dynamic named range with OFFSET in Excel
  • How to get relative column numbers in a range in Excel
  • VLOOKUP function: Description, Usage, Syntax, Examples and Explanation
  • How to use Excel MATCH Function

Data Validations

  • Excel Data validation specific characters only
  • Data validation must not exist in list
  • Excel Data validation unique values only
  • Excel Data validation must begin with
  • How To Create Drop-down List in Excel

Calculate conditional mode with criteria in Excel

by

To calculate a conditional mode with one or more criteria you can use an array formula based on the IF and MODE functions.

Note: this is an array formula and must be entered with control + shift + enter.

Formula

{=MODE(IF(criteria,data))}

Calculate conditional mode with criteria in Excel

Explanation

In the example shown, the formula in F5 is:

{=MODE(IF(group=E5,data))}

where “group” is the named range B5:B14, and “data” is the named range C5:C14.

How this formula works

The MODE function has no built-in way to apply criteria. If you give it a range, it will return the most frequently occurring number in the range.

Worked Example:   How to count line breaks in cell in Excel worksheet

To apply criteria, we use the IF function to test each data value in “group” to see if it matches the value in E5 (“A”):

IF(group=E5,data)

Because the logical test is based on an array containing multiple values (the named range “group”), the result is an array of TRUE FALSE results:

{TRUE;FALSE;TRUE;FALSE;TRUE;FALSE;TRUE;FALSE;TRUE;FALSE}

where each TRUE represents a row where the group is “A”. This array acts as a filter: for each TRUE, IF returns the corresponding value in the named range “data”. FALSE values remain unchanged. The final result of IF is this array:

{3;FALSE;3;FALSE;5;FALSE;1;FALSE;2;FALSE}

Notice only data values in group A have “survived”; group B values are now FALSE. This array goes into the MODE function, which returns the most frequently occurring number in group A, which is 3.

Worked Example:   How to display conditional message with REPT function in Excel

Note: when IF is used this way to filter values with an array operation, the formula must be entered with control + shift + enter.

Worked Example:   How to strip numeric characters from cell in Excel

Additional criteria

To apply more than one criteria, you can nest another IF inside the first IF:

{=MODE(IF(criteria1,IF(criteria2,data)))}

Post navigation

Previous Post:

How to generate random date between two dates in Excel

Next Post:

Popularly Used Excel Functions and their examples

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others

Logical Functions

  • FALSE function: Description, Usage, Syntax, Examples and Explanation
  • Check multiple cells are equal in Excel
  • OR function: Description, Usage, Syntax, Examples and Explanation
  • IFNA function: Description, Usage, Syntax, Examples and Explanation
  • How to use Excel NOT Function

Date Time

  • Two ways to sum time over 30 minutes in Excel
  • Get last weekday in month in Excel
  • How to get workdays between dates in Excel
  • Pad week numbers with zeros in Excel
  • Add decimal hours to time in Excel

Grouping

  • Group arbitrary text values in Excel
  • Running count group by n size in Excel
  • Group numbers with VLOOKUP in Excel
  • Map inputs to arbitrary values in Excel
  • Group numbers at uneven intervals in Excel

General

  • Share Excel data with Word documents
  • Creating and Opening an existing file in Excel
  • Using Existing Templates in Excel
  • Subtotal invoices by age in Excel
  • How to Create Calendar in Excel
© 2023 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning