
/Webp.net-resizeimage-5b74dbc146e0fb00504b5d2f.jpg)
In the case of duplicates, it returns the same number.So I will use helper columns to address each of these issues.Įnter the following COUNTIF formula in Helper Column 1 =COUNTIF($A$2:$A$9,"<="&A2) You can see there are duplicate values, blank and numbers. I will use 4 helper columns to show you how it works (and then give you a huge formula that will do it without the helper columns). When Data is a Mix of Numbers, Text, Duplicates, & Blanks

You have a mix of numbers and text (try putting 123 in one of the cells).You have duplicates in the data (try putting US twice).This formula works well if you have text or alphanumeric values. This is an array formula, so use Control + Shift + Enter instead of Enter. Here is a formula that will do the same without the helper column. In the second cell, it returns Canada (which has the number 2) and so on.

In the first cell (C2), it looks for the country name that has the lowest number (Australia has 1). This formula simply extracts the names in the alphabetical order. Now to sort the values, use the following combination of INDEX, MATCH and ROWS functions: =INDEX($A$2:$A$9,MATCH(ROWS($B$2:B2),$B$2:$B$9,0)) For example, in cell B2, it returns 8, as there are 8 text values that are lower than or equal to the text ‘US’ (alphabetical order). This formula compares a text value with all the other text values and returns its relative rank. In the column next to the data, use the following COUNTIF formula: =COUNTIF($A$2:$A$9,"<="&A2) To sort this, I will use a helper column. In this example, all the data is in text format (no numbers, blanks or duplicates). When the Data is all Text with No Duplicates This means you can add data, and it will automatically sort it for you. In this post, I will show you various ways to sort data in alphabetical order using formulas. If you sort data and then add data to it, you would need to sort it again. Excel built-in data sorting is amazing, but it isn’t dynamic.
