在 Google 个工作表中使用具有多个数量的单个值计算数据集的统计数据

Calculating statistical data for data sets by using single values with multiple quantities in Google Sheets

在 Google 表格中,我一直在处理不同价格的数据集,将它们与实际成本进行比较,并排除正常范围之外的值。我以前有过帮助,但我无法根据我曾帮助过的原始公式设计更多公式。

在我的数据集中,我有非常大的扩展数据集,我手动输入了多个数字重复出现的地方。我将每个值都标记为 value (x),其中 X 表示数据集中出现的数量或总数以使其更小;因为我需要手动输入每个

计算平均值的公式如下:

=ARRAYFORMULA(SUM(QUERY(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
 IF(ISNUMBER(A19:AP19), "♦"&A19:AP19&" 1", IF((A19:AP19<>"")*(NOT(ISNUMBER(A19:AP19))), "♦"&REGEXREPLACE(A19:AP19, "[()]", ), ))),,99^99)),,99^99), "♦")), " "), 
 "select Col1*Col2 label Col1*Col2 ''", 0))/SUM(QUERY(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
 IF(ISNUMBER(A19:AP19), "♦"&A19:AP19&" 1", IF((A19:AP19<>"")*(NOT(ISNUMBER(A19:AP19))), "♦"&REGEXREPLACE(A19:AP19, "[()]", ), ))),,99^99)),,99^99), "♦")), " "), 
 "select Col2", 0)))

这非常有效。我还有一个公式可以计算数据集的最小值和最大值。

我试图编辑代码,为自己提供模式(不会读取 value (x) 值)和 IQR(四分位间距),但完全没有成功。

我希望能够在使用使用 values (x)

标记的值时找到数据集的标准偏差、平均偏差和 IQR

下面是数据集样本的 link: https://docs.google.com/spreadsheets/d/15-UY7salQ8fI011twnIKSjEJQWCSVmfV1wErE28gvKw/edit?usp=sharing

解决方案

Google Sheets 具有针对这些统计变量的自定义公式。使用这些如下:

希望对您有所帮助。让我知道您是否需要其他任何东西或者您不明白什么。 :)

基本公式(取范围 B14:B 并扩展格式为 value (x) 的所有值)

=ARRAYFORMULA(TRANSPOSE(SPLIT(QUERY(REPT(
 INDEX(IF(B14:B="",,SPLIT(IF(ISNUMBER(B14:B), B14:B&" 1", B14:B), " ()"))*1,,1)&"♦", 
 INDEX(IF(B14:B="",,SPLIT(IF(ISNUMBER(B14:B), B14:B&" 1", B14:B), " ()"))*1,,2)),,999^99), "♦")))


平均 (B3)

=ARRAYFORMULA(SUM(QUERY(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
 IF(ISNUMBER(B14:B), "♦"&B14:B&" 1", IF((B14:B<>"")*(NOT(ISNUMBER(B14:B))), 
 "♦"&REGEXREPLACE(B14:B, "[()]", ), ))),,99^99)),,99^99), "♦")), " "), 
 "select Col1*Col2 label Col1*Col2 ''", 0))/
 SUM(QUERY(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
 IF(ISNUMBER(B14:B), "♦"&B14:B&" 1", IF((B14:B<>"")*(NOT(ISNUMBER(B14:B))), 
 "♦"&REGEXREPLACE(B14:B, "[()]", ), ))),,99^99)),,99^99), "♦")), " "), 
 "select Col2", 0)))

范围 (B4)

=B7-B8

中位数 (B5)

=ARRAYFORMULA(MEDIAN(TRANSPOSE(SPLIT(QUERY(REPT(
 INDEX(IF(B14:B="",,SPLIT(IF(ISNUMBER(B14:B), B14:B&" 1", B14:B), " ()"))*1,,1)&"♦", 
 INDEX(IF(B14:B="",,SPLIT(IF(ISNUMBER(B14:B), B14:B&" 1", B14:B), " ()"))*1,,2)),,999^99), "♦"))))

模式 (B6)

=ARRAYFORMULA(MODE(TRANSPOSE(SPLIT(QUERY(REPT(
 INDEX(IF(B14:B="",,SPLIT(IF(ISNUMBER(B14:B), B14:B&" 1", B14:B), " ()"))*1,,1)&"♦", 
 INDEX(IF(B14:B="",,SPLIT(IF(ISNUMBER(B14:B), B14:B&" 1", B14:B), " ()"))*1,,2)),,999^99), "♦"))))

最大 (B7)

=ARRAYFORMULA(MAX(QUERY(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(B14:B)
,,99^99)),,99^99), " ")), "where not Col1 contains '-'", 0)))

最小值 (B8)

=ARRAYFORMULA(MIN(QUERY(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(B14:B)
,,99^99)),,99^99), " ")), "where not Col1 contains '-'", 0)))

IQR - 四分位间距 (B9)

=ARRAYFORMULA(QUARTILE(TRANSPOSE(SPLIT(QUERY(REPT(
 INDEX(IF(B14:B="",,SPLIT(IF(ISNUMBER(B14:B), B14:B&" 1", B14:B), " ()"))*1,,1)&"♦", 
 INDEX(IF(B14:B="",,SPLIT(IF(ISNUMBER(B14:B), B14:B&" 1", B14:B), " ()"))*1,,2)),,999^99), "♦")), 3)-
 QUARTILE(TRANSPOSE(SPLIT(QUERY(REPT(
 INDEX(IF(B14:B="",,SPLIT(IF(ISNUMBER(B14:B), B14:B&" 1", B14:B), " ()"))*1,,1)&"♦", 
 INDEX(IF(B14:B="",,SPLIT(IF(ISNUMBER(B14:B), B14:B&" 1", B14:B), " ()"))*1,,2)),,999^99), "♦")), 1))

平均偏差 (B10)

=ARRAYFORMULA(AVEDEV(TRANSPOSE(SPLIT(QUERY(REPT(
 INDEX(IF(B14:B="",,SPLIT(IF(ISNUMBER(B14:B), B14:B&" 1", B14:B), " ()"))*1,,1)&"♦", 
 INDEX(IF(B14:B="",,SPLIT(IF(ISNUMBER(B14:B), B14:B&" 1", B14:B), " ()"))*1,,2)),,999^99), "♦"))))

标准偏差 (B11)

=ARRAYFORMULA(STDEV(TRANSPOSE(SPLIT(QUERY(REPT(
 INDEX(IF(B14:B="",,SPLIT(IF(ISNUMBER(B14:B), B14:B&" 1", B14:B), " ()"))*1,,1)&"♦", 
 INDEX(IF(B14:B="",,SPLIT(IF(ISNUMBER(B14:B), B14:B&" 1", B14:B), " ()"))*1,,2)),,999^99), "♦"))))