In google sheets, using UNIQUE on a column causes all of the unique values to be displayed in a column.
Is there a way to have all of the values displayed in a row instead of a column?
You can use this:
=TRANSPOSE(UNIQUE(E1:E7))
(Do adjust the formula according to your ranges and locale)
Functions used:
TRANSPOSE
UNIQUE
try this:
=UNIQUE(FLATTEN(A1:D1))
Related
I have a google sheet column with data that looks like this. ID numbers with count suffixes. How can I transpose them horizontally into rows on a sheet sorted/grouped/filtered by their ID number into the appropriate number of columns matching their suffix number?
Sheet Link:
https://docs.google.com/spreadsheets/d/1wq3Zrh5wE_IHP2utvMeFRHrMe1qra2ppq_G7PrSt-jY/edit?usp=sharing
What I have
INV46673-1
INV46673-2
INV56184-1
INV56184-2
INV56184-3
INV56184-4
INV56184-5
INV68328-1
INV68328-2
INV68328-3
INV68328-4
INV68347-1
INV68347-2
INV68347-3
What I need
INV46673-1
INV46673-2
INV56184-1
INV56184-2
INV56184-3
INV56184-4
INV56184-5
INV68328-1
INV68328-2
INV68328-3
INV68328-4
INV68347-1
INV68347-2
INV68347-3
If sheets has an off the shelf function for this I have not been able to find it. I have tried pivot tables, Hlookup, filtered arrays etc. I am grateful for any advice I may receive. A solution that uses a fixed character count (8) will work but I would love to see something that actually uses the exact ID number.
Try the following formula-
=INDEX(SPLIT(BYROW(UNIQUE(INDEX(SPLIT(A2:A15,"-"),,1)),LAMBDA(x,JOIN("|",SORT(FILTER(A2:A15,INDEX(SPLIT(A2:A15,"-"),,1)=x))))),"|"))
Here's another approach:
=index(let(a,regexextract(A2:index(A:A,counta(A:A)),"(.*)-(\d+)"),b,unique(index(a,,1)),c,max(--index(a,,2)),makearray(counta(b),c,lambda(r,x,xlookup(index(b,r)&"-"&index(sequence(1,c),,x),A:A,A:A,)))))
I want to join the text but the number of rows differ for each record. If I use the static range data is missing for few records, in below example 22Inch is missing,
Used the below formula. How to dynamically change the range.
=TEXTJOIN(",",TRUE,A3:A8,"")
try:
=TEXTJOIN(",", 1, A3:INDEX(A:A, MIN(IFERROR(1/(1/(ROW(A3:A)*(A3:A="")))))))
Can you test this one out:
=LAMBDA(z,BYROW(z,LAMBDA(a,REGEXREPLACE(TEXTJOIN(",",1,IFNA(FILTER(A2:A,XLOOKUP(ROW(B2:B),z,z,,-1)=a))),"^(.*?)\,",""))))({ROW();BYROW(A3:A,LAMBDA(z,IF((z<>"")*(OFFSET(z,-1,0)=""),ROW(z),)))})
Here's another formula you can try:
=QUERY(INDEX(LAMBDA(ζ,SORT(REGEXREPLACE(ζ,"^,",),COUNTIFS(A1:A,"",ROW(A1:A),"<="&ROW(A1:A)),1,LEN(ζ),))({"";IF({A3:A;""}<>"",,SCAN(,A2:A,LAMBDA(a,c,IF(c="",,a&","&c))))})),"limit "&ROWS(A2:A))
In google sheets, using UNIQUE on a column causes all of the unique values to be displayed in a column.
Is there a way to have all of the values displayed in a row instead of a column?
You can use this:
=TRANSPOSE(UNIQUE(E1:E7))
(Do adjust the formula according to your ranges and locale)
Functions used:
TRANSPOSE
UNIQUE
try this:
=UNIQUE(FLATTEN(A1:D1))
How do I go about using REGEXREPLACE to insert commas into values in Google Sheets? Example:
cell A1 = 1234567890
expected output in B1 = 1,234,567,890
edit:
The intention would be so that the user would not need to format anything themselves. This issue is from a template I'm doing up, sample sheet here - https://docs.google.com/spreadsheets/d/1n-KXqcSpx_DpvrOv9A4UsKn1amGGEUCpyzWWDphWdJY/edit?usp=sharing
try:
=TEXT(A1; "#,###,###,##0")
Try
=A1
and change the format to
#,##0
To insert commas into values in Google Sheets, I recommend:
Select the range of cells you'd like to format or modify.
Click Format and then Number.
Select the format to apply to the range of cells.
E.g. I have the following sheet and formula, but I only want to transpose the data if it contains a specific month, specified in A2.
try:
=TRANSPOSE(UNIQUE(FILTER(A5:A; B5:B=A2)))
You can use a query for that.
=TRANSPOSE(QUERY(A5:C, "select A where month(B)+2="&MONTH(A2)&""))
The reason we add +1 is because months in a query start from 0