## How to sort text cells filtered by two dates, part 2

*Article updated on July 19, 2017*

In a previous article How to sort cells filtered by two dates I came up with a solution on how to sort cells containing numbers, filtered by two dates. In this article I will sort cells containing text values.

Chandoo at Pointy haired Dilbert posted a great article Sorting Text in Excel using Formulas that has inspired me.

I will use Excel´s countif function in this article.

**COUNTIF(**range,criteria**)**

Counts the number of cells within a range that meet a given condition

**Answer:** Yellow cells are input cells. The gray area is the sorted value list.

Here is the formula in G4:G17

=IF(SUM(IF(($A$4:$A$17<E4)*($A$4:$A$17>D4),1,0))>=ROW()-3,INDEX(C4:C17, MATCH(SMALL(IF(($A$4:$A$17<E4)*($A$4:$A$17>D4), COUNTIF($C$4:$C$17,"<"&$C$4:$C$17)+1,""),ROW()-3), COUNTIF($C$4:$C$17,"<"&$C$4:$C$17)+1,0)),"") + Ctrl + Shift + Enter

Download excel sample file for this tutorial

sort-text-cells-between-two-dates

(Excel 97-2003 Workbook *.xls)

**Functions in this article:**

**MATCH(**lookup_value;lookup_array; [match_type]

Returns the relative position of an item in an array that matches a specified value

**INDEX(**array,row_num,[column_num]**)**

Returns a value or reference of the cell at the intersection of a particular row and column, in a given range

**IF(**logical_test;[value_if:true];[value_if_false]**)
**Checks whether a condition is met, and returns one value if TRUE, and another value if FALSE

**COUNTIF(**range,criteria**)**

Counts the number of cells within a range that meet a given condition

**SMALL(**array,k**)** returns the k-th smallest row number in this data set.

**ROW(**reference**)** returns the rownumber of a reference

**SUM(**number1,[number2],**)
**Adds all the numbers in a range of cells

Lookup and return multiple values concatenated into one cell

This article demonstrates how to find a value in a column and concatenate corresponding values on the same row. The […]### Leave a Reply

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

<code>your formula</code>

Remember to convert less than and larger than signs to html character entities before you post your comment.

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

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

VBA code

[/vb]

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

Upload picture to postimage.org

Add picture link to comment.

**Contact Oscar**

You can contact me through this webpage

## Share this article