Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法根据相邻列是否包含一组值内的值来计算一列中一组值的中位数?
下面是一个表格示例:
我想获得来自美国的所有收入的中位数(合并美国东部和西部团队)。
首先,您必须根据您的标准过滤此表,然后从新范围中提取中值。
可以使用 QUERY 函数进行过滤,然后使用内置的 MEDIAN 公式。
我准备了我的例子,它使用了两个条件——比如你的。
=median(query(B2:C11,"select B where C ='a' or C='b'"))
我认为最简单的方法是使用过滤器和正则表达式:
=median(filter(B2:B,regexmatch(C2:C,"^Team US")))
或者如果有更多像 Team US North 这样的团队并且您不想包括它们:
=median(filter(B2:B,regexmatch(C2:C,"^Team US East|^Team US West")))