I'm working on Google Sheet spreadsheets and I'm looking to get in a column the unique values of the table I show.
Suppose the table has the following values
A-B-C
B-C
A-D
With the Split function I can separate the values.
=SPLIT(B12;"-")
A B C
B C
A D
I'm stuck on the final point, which is to get the unique values.
A
B
C
D
In a single formula (sorted, no blanks):
=sort(unique(transpose(split(textjoin("-",1,A:A),"-"))))
Assuming your data is in columns A:C, =UNIQUE({A1:A3;B1:B3;C1:C3}).
You can also unbind the ranges. =UNIQUE({A:A;B:B;C:C}).
The curly braces {} combine the ranges.
The semi colons ; tell the curly braces to combine the ranges vertically into a single column for the UNIQUE function to parse.
Related
I have a table like this one here (basically it's data from a google form with multiple choice answers in column A and B and non-muliple choice data in column C) I need a separate row for each multiple choice answer.
Column A
Column B
Email
A,B
XX,YY
1#gmail.com
A,C
FF,DD
2#gmail.com
I tried to un-nest the first column and keep the remaining columns like this
enter image description here
I tried several approaches I found with flatten and split with array formulas but I don't know where to start really.
Any help or hint would be much appreciated!
You can use the split function on the column A and after that, use the index function. Considering the table, you can use:
=index(split(A2,","),1,1)
The split function separate the text using the delimiter indicated, returning an array with 1 line and 2 columns; the index function will return the first line and the first column from this array. To return the second element from the column A, just change to
=index(split(A2,","),1,2)
I think there's no easy solution for this. You're asking for as many combinations of elements as multiple-choice elections have been made. Any function in Google Sheets has its potentials and limitations about how many elements it can express. One very useful formula here is REDUCE. With REDUCE and sequences of elements separated by commas counted with COUNTA, you can stablish this formula:
=QUERY(REDUCE({"Col A","Col B","Email"},SEQUENCE(COUNTA(A2:A)),LAMBDA(z,c,{z;LAMBDA(ax,bx,
REDUCE({"","",""},SEQUENCE(ax),LAMBDA(w,a,
{w;
REDUCE({"","",""},SEQUENCE(bx),LAMBDA(y,b,
{y;INDEX(SPLIT(INDEX(A2:A,c),","),,a),INDEX(SPLIT(INDEX(B2:B,c),","),,b),INDEX(C2:C,c)}
))})))
(COUNTA(SPLIT(INDEX(A2:A,c),",")),COUNTA(SPLIT(INDEX(B2:B,c),",")))})),
"Where Col1 is not null",1)
Since I had to use a "initial value" in every REDUCE, I then used QUERY to filter the empty values:
I need to automatically calculate the respective score of list of entries in a list. Basically I need something in the lines of "If letters in column F exist in column A, then sum for each entry in column A and if letter not found in F then return 0". It should be an array type of formula.
I tried both query function, which didn't work the way I wrote it, and arrayformula, but it doesn't give me sum per row.
=query(b3:g,"select sum (G) when F contains B group by B")
=arrayformula(sumifs(G4:G,B4:B,F4:F))
I know you can use a combination with mmult, but I don't know how to combine that with matching the column values for the letters in the list.
The file is listed below and is structured as following.
The score list in column A is fixed, and each month data in F-G column is posted, if the score is 0 for that month then the letter doesn't show up in the F column. I need an automatic way to calculate so I get the numbers in sheet 2.
https://docs.google.com/spreadsheets/d/1eyyqNL-LKw5F4kdDnbAPzN28jc4kWKMCJ-GAkn2yoXg/edit?usp=sharing
MAP() or BYROW() will do the trick. Try below formula-
=MAP(B3:B17,LAMBDA(x,SUMIFS(G3:G,F3:F,x)))
For >300 use-
=MAP(B3:B17,LAMBDA(x,SUMIFS(G3:G,F3:F,x,G3:G,">300")))
To make your input reference dynamic can use B3:INDEX(B3:B,COUNTA(B3:B)) as array argument or MAP() function. Try-
=MAP(B3:INDEX(B3:B,COUNTA(B3:B)),LAMBDA(x,SUMIFS(G3:G,F3:F,x)))
Trying to obtain desired output shown in E:G from a data show in A:C. I can write a formula
JOIN(", ", FILTER($B$2:$B,$C$2:$C=E2,$A$2:$A=F2))
If there would be a single value in F2 I could get comma-separated output items from column B. But I need to do that for more than one value in F2 cell and get the output shown in column G. How to write a formula that can generate column G as desired?
Any help is welcome.
If you're happy with formula dragging down each cell, as per your example in cell F2, then G2 could be:
=join(",",unique(filter({$A:$A&"("&$B:$B&")"},$C:$C=$E2)))
There are more complex formula to do the calcs with an arrayformula.
Within the filter, there are {} brackets that are used to build an array of data. The array consists of Col A then ( then Col B then ).
It then works the same way as per your example in cell F2. The filter finds each row of the array where Col C matches the value in Col E. Unique and join get the results the same way.
When you drag down the formula, textjoin might be more helpful in ignoring empty cells than join.
Use this in cell F2:
=textjoin(",",true,filter(A:A,C:C=E2))
this in cell G2:
=textjoin(",",true,unique(filter(if($A:$A<>"",{$A:$A&"("&$B:$B&")"},),$C:$C=$E2)))
Using arrays in Google Sheets
https://support.google.com/docs/answer/6208276/using-arrays-in-google-sheets?hl=en-GB
I have an Google sheets file with two sheets. I'm trying to reference one sheet's text based on two cells of criteria using a formula in the other sheet. I have one sheet that looks similar to this -
And another that looks like this -
I would like to put a formula on the second sheet that basically says - look on the first sheet for the values in columns A and B and return me the value in column C. The tricky part is - the values in the second sheet may be inverted or there may be an instance where only one value is present, like in row 1 in the first sheet. Also the formula should only fill in a value if both columns match. All text combinations in both sheets are unique.
Is it possible to do this with text? Thank you for your help!
Try the following
=ArrayFormula((IFERROR(VLOOKUP(R2:R&S2:S,{O2:O&P2:P,Q2:Q},2,0))&
IFERROR(IF((R2:R<>"")*(S2:S<>""),VLOOKUP(R2:R&S2:S,{P2:P&O2:O,Q2:Q},2,0),""))))
(Do adjust locale and ranges according to your needs)
Functions used:
ArrayFormula
IFERROR
IF
VLOOKUP
If you can use two keys concated in the lookup table as a virtual key (i.e. make a key like "CAT|DOG"), then you can use that to look in the secondary table.
If you can't guarantee the sort order of the two keys in the secondary table, you can use the following technique to "sort" the two keys so you can make a single lookup key that's always in one stable order.
Sample Table
A
B
C
D
E
SortedKey
Cat
Dog
TRUE
Cat
Dog
CatDog
Dog
Cat
FALSE
Cat
Dog
CatDog
Formulas
Sample formulas for row #1.
For column C, use formula: =A1<B1
For column D, use formula: =IF(C1=TRUE, A1, B1)
For column E, use formula: =IF(C1=TRUE, B1, A1)
For SortedKey, use formula: =concat(D1, E1)
I am working with a google sheet that in one column can hold 1+ strings of numbers, and in another column, needs to read those numbers in and concat them with a link.
What I mean by this is and what works thus far: Column A - 324243324 || Column B - =concat("google.com/", Column A) = google.com/324243324
What I hope to get working: Column A - 324243324 5004938 || Column B - =concat("google.com/", Column A) = google.com/324243324 google.com/5004938
Is this possible? Thank you for your help!
You want to (a) split the input by spaces; (b) prepend each part by "google.com/"; and (c) join again, separated by spaces. This is achieved by
=join(" ", arrayformula("google.com/" & split(A1, " ")))
The & operator is equivalent to CONCAT but easier to type. arrayformula indicates that the operation is done on an array (the output of split).
However, these links will not be hyperlinked; joining makes them into plain text. To keep them functional, remove the last step, "join", so that each link appears in its own cell.