regex - 如何在 Google Sheets 中合并两个数组查询的代码
问题描述
我需要合并两个都在 arrayformulas 中的查询,这样我就只有一个查询:
我试过使用联合
第一个代码:
= ARRAYFORMULA(QUERY({MID(Sheet1!B1:B, 8, 5), Sheet1!A1:AS},
"select count(Col13)
where Col13>=0
group by Col1
label count(Col13)'Winners #'"))
第二个代码:
= ARRAYFORMULA(QUERY({MID(Sheet1!B1:B, 8, 5), Sheet1!A1:AS},
"select count(Col13)
where Col13<=0
group by Col1
label count(Col13)'Losers #'"))
解决方案
=ARRAYFORMULA(QUERY(REGEXREPLACE(TO_TEXT(QUERY({
QUERY({MONTH(MID('grouping project'!A2:A, 8, 3)&1)&"♦"&
MID('grouping project'!A2:A, 8, 5), 'grouping project'!A2:AO},
"select Col1,count(Col3),'Winners #'
where Col1 is not null
and Col3 >= 0
group by Col1
label count(Col3)'','Winners #'''", 0);
QUERY({MONTH(MID('grouping project'!A2:A, 8, 3)&1)&"♦"&
MID('grouping project'!A2:A, 8, 5), 'grouping project'!A2:AO},
"select Col1,count(Col3),'Loosers #'
where Col3 <= 0
and Col1 is not null
group by Col1
label count(Col3)'','Loosers #'''", 0)},
"select Col1,sum(Col2)
group by Col1
pivot Col3
label Col1'Week ending'", 0)), "^.+♦", ),
"where Col1 is not null", 0))
推荐阅读
- python - 在 python 中使用 Projected Successive Overrelaxation Solver 实现 Crank Nicolson
- macos - 更新到 zsh 现在终端 bash 配置文件不再显示自定义提示
- .htaccess - 在 .htaccess 中为相同的页面结构重写 URL
- visual-studio-code - 我无法使用 vscode 的 remote-ssh 连接到服务器
- azure - Azure.Security.KeyVault.Secrets 中的 Azure.RequestFailedException
- java - 尝试使用准备好的语句占位符作为聚合函数的参数时出现 JDBC 异常
- reactjs - 反应路线和 navhashlink 问题
- c# - 如何使用搜索图像调整要以任何分辨率读取的图像
- python - 在Python中使用前向和后向填充窗口进行分组和重新采样
- flutter - Flutter Web 允许溢出/双向滚动