Is it possible for the new function UNIQUE
to be used across various columns & have the output spill into a single column?
Desired output is UNIQUE
values in one single column based on all of the values present in Columns: A, B, & C
(duplicates in red)
A simple way to get unique values from a list where the values will not change is to use the Remove Duplicates functionality, which can be found under the Data menu.
Navigate to the "Home" option and select duplicate values in the toolbar. Next, navigate to Conditional Formatting in Excel Option. A new window will appear on the screen with options to select "Duplicate" and "Unique" values. You can compare the two columns with matching values or unique values.
There may be a better approach, but here is one using TEXTJOIN and FILTERXML to create an array that you can call UNIQUE on:
=SORT(UNIQUE(FILTERXML("<t><s>"&TEXTJOIN("</s><s>",TRUE,A1:C6)&"</s></t>","//s")))
New Answer:
Ms365's new array shaping functions will be useful:
=UNIQUE(TOCOL(A2:C7,3,1))
TOCOL()
would return a vector of all values other than error or empty (3) values per column (1).
Old Answer:
Using Microsoft365 with access to LET()
, you could use:
Formula in E2
:
=LET(X,A2:C7,Y,SEQUENCE(ROWS(X)*COLUMNS(X)),Z,INDEX(IF(X="","",X),1+MOD(Y,ROWS(X)),ROUNDUP(Y/ROWS(X),0)),SORT(UNIQUE(FILTER(Z,Z<>""))))
This way, the formula becomes easily re-usable since the only parameter we have to change is the reference to "X".
For what it's worth, it could also be done through PowerQuery A.K.A. Get&Transform, available from Excel2013 or a free add-in for Excel 2010.
The above will take care of empty values too. Now:
Resulting table:
M-Code:
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"A Values", Int64.Type}, {"B Values", Int64.Type}, {"C Values", Int64.Type}}),
#"Transposed Table" = Table.Transpose(#"Changed Type"),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Transposed Table", {}, "Attribute", "Value"),
#"Removed Columns" = Table.RemoveColumns(#"Unpivoted Columns",{"Attribute"}),
#"Sorted Rows" = Table.Sort(#"Removed Columns",{{"Value", Order.Ascending}}),
#"Removed Duplicates" = Table.Distinct(#"Sorted Rows")
in
#"Removed Duplicates"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With