## SMALL function – multiple conditions

The array formula in D10 extracts numbers sorted from small to large from column D if Region is equal to North **AND** Category is X on the same row.

To enter an array formula, type the formula in a cell then press and hold CTRL + SHIFT simultaneously, now press Enter once. Release all keys.

The formula bar now shows the formula with a beginning and ending curly bracket telling you that you entered the formula successfully. Don't enter the curly brackets yourself.

There are two logical expressions in the formula returning boolean values TRUE or FALSE.

The asterisk between the logical expressions multiply the boolean arrays, this will help us extract numbers where both conditions match on the same row.

and returns {1;0;0;0;1}.

The IF function then returns the corresponding values from column D if TRUE and a blank "" if FALSE.

becomes

and returns {130;"";"";"";100}.

The SMALL function returns the k-tk smallest value the array determined by ROWS($A$1:A1).

The cell reference in ROWS($A$1:A1) expands when you copy the cell and paste it to cells below.

The smallest value is shown in D10, ROWS($A$1:A1) returns 1. The second smallest value is shown in D11, ROWS($A$1:A2) returns 2.

The ROWS function has a great advantage, it won't break the formula if you insert or delete rows above the array formula.

The array formula in D10 extracts numbers sorted from small to large from column D if Region is equal to North **OR **Category is X.

The only difference between this formula and the formula above is the plus sign instead of the asterisk.

If you add the logical expressions you get what the image above shows. All numbers except 0 (zero) equal TRUE and 0 (zero) is FALSE.

The formula above in D10 extracts numbers sorted from small to large if both Region and Category match on the same row in both tables.

This formula is similar to the first formula, however, the COUNTIFS function allows you to easily use multiple criteria without building huge formulas.

The formula above in D10 extracts numbers sorted from small to large if both Region **and** Category match any of the criteria.

Example, Z on row 7 is not a match to any of the Category values in the lower table, both values must match.

The formula above in D10 extracts numbers sorted from small to large if any of the Region **or **Category values match.

### Download Excel *.xlsx file

The SMALL function lets you extract a number in a cell range based on how small it is compared to the other numbers in the group.

SMALL function with duplicates

The formulas in column E, shown in the picture above, extracts the k-th smallest value from B3:B9 ignoring the duplicate numbers. […]

The array formula in cell C11 gets 3 values in one fetch, the INDEX function allows you to do that […]

The array formula in column E, shown in above picture sorts text values from column B. The Length columns prove […]

How to ignore zeros using the SMALL function

The formula in cell D3 is an array formula, it will extract the k-th smallest value ignoring zeros. Related articles

SMALL function with multiple cell ranges

Today I learned how to sort numbers from multiple cell ranges thanks to Sam Miller. It is surprisingly simple and easy. […]

How to ignore error values using the SMALL function

The image above shows you a formula in cell D3 that tries to get the smallest number from cell range […]

### Leave a Reply

### How to comment

**How to add a formula to your comment**

<code>Insert your formula here.</code>

**Convert less than and larger than signs**

Use html character entities instead of less than and larger than signs.

< becomes < and > becomes >

**How to add VBA code to your comment**

[vb 1="vbnet" language=","]

Put your VBA code here.

[/vb]

**How to add a picture to your comment:**

Upload picture to postimage.org or imgur

Paste image link to your comment.

**Contact Oscar**

You can contact me through this contact form