Hello all you amazing people
I wanted to do two things
- populate a unique distinct list from a long list of repetitive values
- extract component of a text delimited with hyphen
I found solutions to each one of these problems at different places.
Unique distinct list here: http://www.get-digital-help.com/2009/03/30/how-to-extract-a-unique-list-and-the-duplicates-in-excel-from-one-column/
The formula is
{=INDEX(A2:A65000,MATCH(0,COUNTIF($B$1:B1,A2:A65000),0))}
Where Column B is where the unique list gets populated
And Extracting (splitting text) from here http://spreadsheetpage.com/index.php/tip/the_versatile_split_function/
Function ExtractElement(str, n, sepChar)
' Returns the nth element from a string,
' using a specified separator character
Dim x As Variant
x = Split(str, sepChar)
If n > 0 And n - 1 <= UBound(x) Then
ExtractElement = x(n - 1)
Else
ExtractElement = ""
End If
End FunctionThe formula below demonstrates how the ExtractElement function can be used in a formula.
=ExtractElement("546-339-909-944",3,"-")
This formula returns 909, the third element in the string (which uses a "-" as the delimiter).
These are great and solve a lot of what I am trying to do. But I am also trying to do both of these functions together to another column.
I have a column with values such as:
Banana - Yellow - Fruit
Sun - Yellow - Star
Blood - Red - Liquid
Exit - Red - Signage
I am trying to get the result as
Yellow
Red
I wish to do this all with formulas and don't want to use helper columns. I don't mind VBA (as you can see, the second link here is vba).
Any help is appreciated. Thanks a million!
Sriram