I have hundred data in spreadsheet. I want to know the count of that fruit name. How can i do this in Spreadsheet?
Example (expected) output:
Banana = 38
Grape = 41
Dates = 29
Orange = 32
..
etc
QUERY() would be good choice.
=QUERY(FLATTEN(B2:J),"select Col1, count(Col1) group by Col1 label Col1 'Fruits', count(Col1) 'Count'")
If you want to exclude blank cells then use
=QUERY(FLATTEN(B2:J),"select Col1, count(Col1)
where (Col1 is not null)
group by Col1
label Col1 'Fruits', count(Col1) 'Count'")
Related
I am trying to query two columns of data in Google Sheets and count how many times the values occur.
I have made a Google Sheets formula which works but only returns data in the first column.
=QUERY(QUERY({D2:D,E2:E}, "select Col1, count(Col1) group by Col1"), "select Col1, Col2 order by Col2 desc, Col1 limit 45", 0)
How can I query and count data from both columns together?
DESIRED RESULT
2.38 / 2
5.38 / 2
...
I have made a Google Sheet showing an example. This can be copied by going to File-Make a Copy
https://docs.google.com/spreadsheets/d/1S5fE43JPVgUhZFVx-rjowkCy8N6p_ziIhIWe4MweiXQ/edit?usp=sharing
If your formula gives the correct output, you may need to change your comma with semicolon. That way all your data will be grabbed as a single column:
=QUERY(QUERY({D2:D;E2:E}, "select Col1, count(Col1) group by Col1"), "select Col1, Col2 order by Col2 desc, Col1 limit 45", 0)
Please try:
=QUERY({D2:D;E2:E},"Select Col1, COUNT(Col1) WHERE Col1 IS NOT NULL GROUP BY Col1 ORDER BY COUNT(Col1) DESC LABEL COUNT(Col1)''")
I am trying to calculate a count of how many times a course is listed in different columns and return the count in a list of all the courses found in those columns.
I have a spreadsheet that shows the start of my formula...
query(UNIQUE({C2:C21; F2:F21;I2:I21}),"select C,F,I, count(C), count(F), count(I) where B is not null group by C,F,I")
Clear cells A23, A24 and B23 and then try in A23
=query({C2:C21; F2:F21;I2:I21},"select Col1, count(Col1) where Col1 <> '' group by Col1 label Col1 'Fall Courses', Count(Col1) 'Count'")
and see if that helps?
If it does, you can repeat the same logic for 'winter' and 'spring'.
Alternatively, you can also try this single formula
=query(ArrayFormula(split(transpose(split(textjoin("~", true, regexreplace(C1:K1, "(Winter|Spring|Fall)", "_$1")&"_"&C2:K21), "~")), "_")), "Select Col3, Count(Col3) where Col3 <>'' group by Col3 pivot Col2", 0)
I want to filter the value in F (F>100) and group values in F according to Values in E, find the total for the group and multiply it with value in B as per the group (ie, A,B,C etc.,) and the final totals of the multiplied values for all groups
sum(A)*20+sum(B)*30+sum(C)*15 and so on
enter image description here
See if this works
=index(query({E:F, IFERROR(F:F*VLOOKUP(E:E, A:B, 2, 0))}, "Select Col1, sum(Col3) where Col2 > 100 group by Col1 label sum(Col3)''", 0))
If Col A will always have A,B,C,D,E in that order:
=arrayformula(if(A:A<>"",{A:A,QUERY({E:F},"select sum(Col2) where Col2 >100 group by Col1 label sum(Col2) '' ",0)*B:B},))
If not:
=arrayformula(if(A:A<>"",QUERY({E:F},"select sum(Col2) where Col2 >100 group by Col1 label sum(Col2) '' ",0)*query({A:B},"select Col2 where Col1 is not null order by Col1",0),))
I have a formula that gets a unique list of titles from pipe-delimited string in a column and there counts
=ArrayFormula(QUERY(TRANSPOSE(SPLIT(JOIN("|",Elements!$H2:$H),"|")&{"";""}),"select Col1, count(Col2) group by Col1 label count(Col2) ''",0))
I need to sort the counts in a descending manor, I have tried adding order by Col2 Desc
=ArrayFormula(QUERY(TRANSPOSE(SPLIT(JOIN("|",Elements!$H2:$H),"|")&{"";""}),"select Col1, count(Col2) group by Col1 label count(Col2) order by Col2 Desc''",0))
But I get unable to parse ...
Thank you
use:
=INDEX(QUERY(TRANSPOSE(SPLIT(JOIN("|", Elements!H2:H), "|")&{"";""}),
"select Col1,count(Col2)
group by Col1
order by count(Col2) desc
label count(Col2)''", 0))
I need to combine duplicate rows then concatenate values in column 2 and sum values in column 3, if row does not have duplicate retain values. I'm using Excel 2010.
Given;
Col1 Col2 Col3
Apple Red 2
Apple Green 5
24829 sk1 2
24829 sd2 8
123 po3 1
Bag black 7
Expected Output:
Col1 Col2 Col3
Apple Red,Green 7
24829 sk1,sd2 10
123 po3 1
Bag black 7
With Google Sheets you could try:
Col G:=unique(A2:A)
Col H:=join(",",filter(B2:B,A2:A=G2))
Col I:=sumif(A2:A,G2,C2:C)
use this one-cell solution:
=ARRAYFORMULA({UNIQUE(INDIRECT("A1:A"&COUNTA(A1:A))),
REGEXREPLACE(TRIM(TRANSPOSE(QUERY(TRANSPOSE(IF(QUERY(QUERY(""&A1:B,
"select count(Col1) where Col1 is not null group by Col1 pivot Col2", 0),
"offset 1", 0)<>"", QUERY(""&A1:B,
"select count(Col1) where Col1 is not null group by Col1 pivot Col2 limit 0")&",", ))
,, 999^99))), ",$", ), QUERY({""&A1:A, C1:C},
"select sum(Col2) where Col1 is not null group by Col1 label sum(Col2)''", 0)})