Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

Group by in lots & text combine - Google Sheets

$
0
0

See gsheet document below. I've got a data set in the "log" tab that I want to automatically aggregate in a certain way in the"target" tab every time something new gets added to the log.

So in the target tab I'd need:

  1. Make that tab to populate the info automatically every time I add something new to the log (More countries may appear in the future)
  2. Count no.of items per country, by lots of 50 items in order of appearance (if over 50, duplicate the country and add another row)
  3. Txt combine the codes into the next column.

Is there any way to do this via Script or query function in gsheet?

So far, I've achieved the grouping with the two below formulas:

To group by country and get the count: =QUERY(Log!A2:B,"select B, count(A) group by B")

To txt combine the codes for the grouped countries=TEXTJOIN(", ",1,FILTER(Log!A:A,Log!B:B=A4))

However I haven't been able to find any resource that's in line with the complexity of automatically grouping by lots in order of appearance. If you see my sample, that's the issue I have with "UK" country.

https://docs.google.com/spreadsheets/d/1TNNVCYE8iVIHXV2sIUWpC7jOY6BZ4P5LTPlhCsNQ8NU/edit#gid=1326764343

Thanks in advance for your help!


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>