
There are several order types and each has its own unique identifier - the first character in an order number.Īssuming that orders are in cells B2:B5 and the unique identifier in E1, the formula is as follows: Suppose, you have a list of orders where one cell may contain several order numbers separated by commas or any other delimiter. =SUM((LEN( range) - LEN(SUBSTITUTE( range, character, ""))) / LEN( character))Īnd here is a practical example. This array formula example shows how you can count the number of characters, including spaces, in a range of cells. Array formula to count all characters in a range In the screenshot above, the following Excel array formulas are used (don't forget to press Ctrl + Shift + Enter to enter them correctly): Naturally, you can replace the names in the formula with cell references so that your users can simply type the names in certain cells without modifying your array formula: =MAX(IF(( salesmen_range=" name") * ( products_range=" name"), sales_range,""))Īssuming that the sales person names are in column A, product names are in column B and sales are in column C, the following formula returns the largest sale Mike has made for Apples: Since we are using the AND array operator (*) in the formula, SUM will add up only those rows that have TRUE (1) in both arrays, as shown in the screenshot below: So, what we have here is two arrays of Boolean values, where TRUE equates to 1 and FALSE equates to 0. If you want more information on how the F9 key works, please check out Evaluating portions of an array formula with F9. If you are not interested in tech details, you can skip right to the next formula example.įor better understanding of this formula in particular and Excel array formulas in general, let's select the two expressions within the SUM function's parentheses in the formula bar, and press F9 to view the arrays behind the formula parts. The next couple of paragraphs are intended for those who like looking under the hood. Remember to press Ctrl + Shift + Enter to enter the Excel array formula correctly.

So, you express the conditions as (B2:B10>=A2:A10) and (B2:B10>0), join them using the asterisk (*) that acts as the AND operator in array formulas, and include this expression in the SUM function's argument: This task requires comparing two ranges and this is exactly what Excel array formulas are designed for. And you want to count how many times column B is greater than or equal to column A when a value in column B is greater than 0. Suppose you have 2 columns of numbers, column A (planned) and column B (actual). However, there are tasks where an array formula is the most effective, if not the only, solution. The introduction of SUMIF and COUNTIF functions as well as their plural counterparts in Excel 2007 made the use of array formulas superfluous in many scenarios.


However, like with any other skill, the road to mastery is paved with practice. Mastering Excel array formulas is a long road and last week we took the first steps by learning the basics of array functions and formulas in Excel. Array formulas are one of the most confusing features in Excel, and yet one of the most intriguing and exciting.
