Use VLOOKUP and return multiple values sorted from A to Z
The array formula in column G filters values in column C using a condition in cell E3, comparing it with values in adjacent column B. The filtered values are then sorted from A to Z.
It is possible to build a formula around the VLOOKUP function but it would be big, the following formula is smaller and easier to understand.
Array formula in cell G3:
Watch a video where I explain the formula
Recommended article
Unique distinct list sorted alphabetically based on a condition
The array formula in cell E6 filters values in column C based on value in cell E3, the output is [โฆ]
Unique distinct list sorted alphabetically based on a condition
How to enter an array formula
 Double click on cell G3
 Copy and paste above formula to cell G3
 Press and hold CTRL + SHIFT simultaneously

Press Enter once
 Release all keys
Examine the formula bar and you will see that the formula now has a beginning and ending curly bracket. Don't enter these characters yourself, they appear automatically. Example, {=array_formula}
Recommended article
Array formulas allows you to do advanced calculations not possible with regular formulas.
Explaining formula in cell G3
Step 1  Sort values in column C
COUNTIF($C$3:$C$10, "<"&$C$3:$C$10)
becomes
COUNTIF({"F"; "S"; "G"; "E"; "B"; "N"; "W"; "A"},{"<F"; "<S"; "<G"; "<E"; "<B"; "<N"; "<W"; "<A"})
and returns
{3;6;4;2;1;5;7;0}
Recommended article
How to use the COUNTIF function
Counts the number of cells that meet a specific condition.
How to use the COUNTIF function
Step 2  Extract sort rank numbers for chosen category
IF($E$3=$B$3:$B$10, COUNTIF($C$3:$C$10, "<"&$C$3:$C$10), "")
becomes
IF($E$3=$B$3:$B$10, {3;6;4;2;1;5;7;0}, "")
becomes
IF($E$3=$B$3:$B$10, {3;6;4;2;1;5;7;0}, "")
becomes
IF(1={1;2;1;2;1;1;2;2},{3;6;4;2;1;5;7;0},"")
becomes
IF({TRUE;FALSE;TRUE;FALSE;TRUE;TRUE;FALSE;FALSE},{3;6;4;2;1;5;7;0},"")
and returns
{3;"";4;"";1;5;"";""}
Recommended article
Checks if a logical expression is met. Returns a specific value if TRUE and another specific value if FALSE.
Step 3  Find kth smallest value in array
SMALL(IF($E$3=$B$3:$B$10,COUNTIF($C$3:$C$10,"<"&$C$3:$C$10),""),ROWS($A$1:A1))
becomes
SMALL({3;"";4;"";1;5;"";""},ROWS($A$1:A1))
becomes
SMALL({3;"";4;"";1;5;"";""},1)
and returns 1.
Recommended article
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.
Step 4  Match sort rank to find relative position
MATCH(SMALL(IF($E$3=$B$3:$B$10, COUNTIF($C$3:$C$10, "<"&$C$3:$C$10), ""),ROWS($A$1:A1)), COUNTIF($C$3:$C$10,"<"&$C$3:$C$10), 0)
becomes
MATCH(1, {3;6;4;2;1;5;7;0}, 0)
and returns 5.
Recommended article
Identify the position of a value in an array.
Step 5  Return values
INDEX($C$3:$C$10,MATCH(SMALL(IF($E$3=$B$3:$B$10,COUNTIF($C$3:$C$10,"<"&$C$3:$C$10),""),ROWS($A$1:A1)),COUNTIF($C$3:$C$10,"<"&$C$3:$C$10),0))
becomes
INDEX($C$3:$C$10,5)
becomes
INDEX({"F";"S";"G";"E";"B";"N";"W";"A"},5)
and returns B in cell G3.
Recommended article
Gets a value in a specific cell range based on a row and column number.
Tip! You can easily filter values if you convert your data to an excel table and then sort them:
Become more productive โ Learn Excel Defined Tables
An Excel table allows you to easily sort, filter and sum values in a data set where values are related.
Become more productive โ Learn Excel Defined Tables
Download excel *.xlsx file
Use VLOOKUP and return multiple values sorted from A to Z.xlsx
Recommended articles
Table of Contents Sort a column using array formula Two columns sorting by the second column Sort alphanumeric values I [โฆ]
5 easy ways to VLOOKUP and return multiple values
This post explains how to lookup a value and return multiple values. No array formula required.
5 easy ways to VLOOKUP and return multiple values
Unique distinct records sorted based on count or frequency
Sara asks: How can you use large with multiple criteria?? Example looking for top 5 of a list based on [โฆ]
Unique distinct records sorted based on count or frequency
Sort column based on frequency
Question: How do I create a new unique distinct list from a column. I also want the list sorted from large [โฆ]
Sort column based on frequency
Create a drop down list containing alphabetically sorted values
This article describes how to create a dropdown list populated with sorted values from A to Z. The sorted list [โฆ]
Create a drop down list containing alphabetically sorted values
Create a unique distinct sorted list containing both numbers text removing blanks
The image above demonstrates a formula in cell D3 that extracts unique distinct numbers and text values sorted from A [โฆ]
Create a unique distinct sorted list containing both numbers text removing blanks
5 easy ways to VLOOKUP and return multiple values
This post explains how to lookup a value and return multiple values. No array formula required.
Vlookup with 2 or more lookup criteria and return multiple matches
VLOOKUP and return multiple matches based on many criteria.
Vlookup across multiple sheets
This article demonstrates an array formula that searches two tables on two different sheets and returns multiple results. Sheet1 contains [โฆ]
Lookup and return multiple values on the same row from a range excluding blanks
Jim asks: I downloaded the file lookupvba3. I think I can use this to help me populate a calendar.I substituted [โฆ]
Use a drop down list to search and return multiple values
I will in this article demonstrate how to use a value from a dropdown list and use it to do [โฆ]
Search values distributed horizontally and return corresponding value
Question: Hi, The formula here works great but I can't figure out how to change it to work with data [โฆ]
Vlookup with multiple matches returns a different value
Linda asks in this post: How to return multiple values using vlookup in excel I tried using the formula above [โฆ]
Lookup multiple values in different columns and return multiple values
Jason C asks: I have a set of data, like the one you used in the original example that also [โฆ]
Vlookup a cell range and return multiple values
VLOOKUP a multicolumn range and return multiple values.
2 Responses to โUse VLOOKUP and return multiple values sorted from A to Zโ
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
Hii Oscar
I have a problem and I know you can help me definitely
"Am your way the great ..." this values with space in one cell (B1)
Is there any formula to seperate all strings in one raw like
C1 Am
C2 your
C3 way
C4 the
C5 great
C6
C7
Etc.
Anil
Yes there is but the formula is large:
https://www.getdigitalhelp.com/2011/03/23/texttocolumnssplitwordsinacellexcelarrayformula/
I recommend Rick Rothstein (MVP  Excel)'s formula:
https://www.getdigitalhelp.com/2011/03/23/texttocolumnssplitwordsinacellexcelarrayformula/#comment52519