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

Nested Array and Filter Sorting formula to combine and aggregate into most frequent list

$
0
0

Working on formating a sheet where I need to pull normalized data into an analytics page. The criteria is to pull from one tab to the next.

Get data using B & E and then apply the values to preset grouping and find the total count.

Output should be formatted for the 5 timeframes for 7/14/30/60/90 days. Such as:

7 Days:  1M (7)14 Days: 100M+ (2)30 Days: 50-75M (3)60 Days: 10-20M (8)90 Days: 3-10M (9)

I've been trying with this formula in this sheet but up against a wall so figure I'd see if anyone has a more elegant solution than where I'm at now?

Helper sheet

Here's my logic behind what I'm doing so far:

  1. Categorize data from F column into the grouping sets with ArrayFormula and If statements to normalize the data into the needed format to find frequency.
  2. Filter for each timeframe and count occurances for 7 Days / 14 Days / 30 Days / 60 Days / 90 Days.
  3. Combine results and display data.

I am trying to push this together with a single cell formula but I'm not getting the results needed.

=ARRAYFORMULA(LET(  categories, {"1M", "1-3M", "3-10M", "10-20M", "20-30M", "30-50M", "50-75M", "75M-100M", "100M+"},  timeframes, {7, 14, 30, 60, 90},  labels, {"7 Days", "14 Days", "30 Days", "60 Days", "90 Days"},  result, MAP(timeframes, labels, LAMBDA(days, label,    LET(      filtered, FILTER(Parabolic!F2:F, (Parabolic!B2:B >= TODAY()-days) * (Parabolic!F2:F <> "")),      categoryCounts, COUNTIFS(filtered, categories),      mostFrequentIndex, MATCH(MAX(categoryCounts), categoryCounts, 0),      mostFrequentCategory, INDEX(categories, mostFrequentIndex),      countMostFrequent, MAX(categoryCounts),      label & " " & mostFrequentCategory & " (" & countMostFrequent & ")"    )  )),  TEXTJOIN(" ", TRUE, result)

SOLUTION: I was able to work out a solution, albeit not sure it's really that elegant. Functional but somewhat clunky. If anyone has a better approach I'd really enjoy seeing another way.


Viewing all articles
Browse latest Browse all 9782

Trending Articles



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