Trending October 2023 # Automatically Sort Data In Alphabetical Order Using Formula # Suggested November 2023 # Top 11 Popular | Vibergotobrazil.com

# Trending October 2023 # Automatically Sort Data In Alphabetical Order Using Formula # Suggested November 2023 # Top 11 Popular

You are reading the article Automatically Sort Data In Alphabetical Order Using Formula updated in October 2023 on the website Vibergotobrazil.com. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested November 2023 Automatically Sort Data In Alphabetical Order Using Formula

Excel built-in data sorting is amazing, but it isn’t dynamic. If you sort data and then add data to it, you would need to sort it again.

In this post, I will show you various ways to sort data in alphabetical order using formulas. This means you can add data, and it will automatically sort it for you.

Suppose you have a data as shown below:

In this example, all the data is in text format (no numbers, blanks or duplicates). To sort this, I will use a helper column. In the column next to the data, use the following COUNTIF formula:

=COUNTIF(\$A\$2:\$A\$9,"<="&A2)

This formula compares a text value with all the other text values and returns its relative rank. 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).

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))

This formula simply extracts the names in the alphabetical order. In the first cell (C2), it looks for the country name that has the lowest number (Australia has 1). In the second cell, it returns Canada (which has the number 2) and so on..

Allergic to Helper Columns??

Here is a formula that will do the same without the helper column.

=INDEX(\$A\$2:\$A\$9,MATCH(ROWS(\$A\$2:A2),COUNTIF(\$A\$2:\$A\$9,"<="&\$A\$2:\$A\$9),0))

This is an array formula, so use Control + Shift + Enter instead of Enter.

I will leave it for you to de-code.

This formula works well if you have text or alphanumeric values.

But it fails miserably if:

You have duplicates in the data (try putting US twice).

There are blanks in the data.

You have a mix of numbers and text (try putting 123 in one of the cells).

Now this one is a bit tricky. 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). Suppose you have a data as shown below:

You can see there are duplicate values, blank and numbers. So I will use helper columns to address each of these issues.

Helper Column 1

Enter the following COUNTIF formula in Helper Column 1

=COUNTIF(\$A\$2:\$A\$9,"<="&A2)

This formula does the following:

It returns 0 for blanks.

In the case of duplicates, it returns the same number.

Text and numbers are processed parallelly and this formula returns the same number for text and number (for example 123 and India both get 1).

Helper Column 2

Enter the following IS Function in Helper Column 2:

=--ISNUMBER(A2)

Helper Column 3

Enter the following formula in Helper Column 3:

=--ISBLANK(A2)

Helper Column 4

Enter the following formula in Helper Column 4

=IF(ISNUMBER(A2),B2,IF(ISBLANK(A2),B2,B2+\$C\$10))+\$D\$10

The idea for this formula is to segregate blanks, numbers and text values.

If the cell is blank, it returns the value in cell B2 (which would always be 0) and adds the value in cell D10. In a nutshell, it will return the total number of blank cells in the data

If the cell is a numerical value, it will return the comparative rank and add the total number of blanks. For example, for 123 it returns 2 (1 is the rank of 123 in the data, and there is 1 blank cell)

If it is text, it returns the comparative rank and add the total number of numerical values and blanks. For example, for India, it add the text’s comparative rank in text (which is 1) and adds the number of blank cells and the number of numerical values.

Final Result – Sorted Data

Now we will use these helper columns to get the sorted list. Here is the formula:

=IFERROR(INDEX(\$A\$2:\$A\$9,MATCH(SMALL(\$E\$2:\$E\$9,ROWS(\$F\$2:F2)+\$D\$10),\$E\$2:\$E\$9,0)),"")

This method of sorting now becomes fool-proof. I have shown you the method for 8 items, but you can extend it to as many items as you want.

If you can handle extreme formulas, here is an all-in-one formula that will sort data in alphabetical order (without any helper column).

Here is the formula:

=IFERROR(INDEX(\$A\$2:\$A\$9,MATCH(SMALL(NOT(\$A\$2:\$A\$9="")*IF(ISNUMBER(\$A\$2:\$A\$9),COUNTIF(\$A\$2:\$A\$9,"<="&\$A\$2:\$A\$9),COUNTIF(\$A\$2:\$A\$9,"<="&\$A\$2:\$A\$9)+SUM(--ISNUMBER(\$A\$2:\$A\$9))),ROWS(\$A\$2:A2)+SUM(--ISBLANK(\$A\$2:\$A\$9))),NOT(\$A\$2:\$A\$9="")*IF(ISNUMBER(\$A\$2:\$A\$9),COUNTIF(\$A\$2:\$A\$9,"<="&\$A\$2:\$A\$9),COUNTIF(\$A\$2:\$A\$9,"<="&\$A\$2:\$A\$9)+SUM(--ISNUMBER(\$A\$2:\$A\$9))),0)),"")

Enter this formula in a cell and drag it down to get the sorted list. Also, since this is an array formula, use Control + Shift + Enter instead of Enter.

You May Also Like the Following Excel Tutorials:

You're reading Automatically Sort Data In Alphabetical Order Using Formula

Update the detailed information about Automatically Sort Data In Alphabetical Order Using Formula on the Vibergotobrazil.com website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!