将 LEFT 嵌入 AVERAGEIFS 公式中

发布于 2025-01-12 23:04:14 字数 539 浏览 2 评论 0原文

您好,我正在尝试使用 AverageIFS 公式来计算按月和按地区的平均绩效,但我正在努力让它发挥作用。

我可以让它作为单独的 IF 函数工作,但放在一起它只是返回#VALUE!

单元格 C28 中的公式为 =AVERAGEIFS(2:25,BDPercentage[[#All],[Territory]],$B28,2:2,LEFT(C27,3)&"*")

请参阅单元格 C30,我设法使用此代码将表格第一行的一月平均化=AVERAGEIF(2:2,LEFT(C27,3)&"*",3:25),尽管即使这样也只是返回表格的顶行,而我本以为它会计算一月份所有可用数据的平均值?在此处输入图像描述

注意: 屏幕截图中的表格称为“BDPercentage” 第 2 行由日期字段组成

Hi I'm trying to use an AverageIFS formula to work out the average performance by month and by territory but I'm struggling to get it to work.

I can get it to work as individual IF functions but together it's just returning #VALUE!

The formula seen in cell C28 is =AVERAGEIFS(2:25,BDPercentage[[#All],[Territory]],$B28,2:2,LEFT(C27,3)&"*")

See in Cell C30 I manage to get it to Average just the Januarys for the first line of the table using this code =AVERAGEIF(2:2,LEFT(C27,3)&"*",3:25), although even that is just returning the top line of the table when I would have thought it would average all the data available for January?enter image description here

NOTES:
The table in the screenshot is called "BDPercentage"
Row 2 consists of Date fields

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

£烟消云散 2025-01-19 23:04:14

回复:您的主要目标:

按月份和地区计算平均绩效

将日期标题格式化为日期,即:

=DATE(2020,1,1)

Date formatted headers

(日期无关紧要)

接下来,使用以下公式计算平均值(很多)不同的方式,这只是其中之一......按预期工作):

=LET(x_,(MONTH($E$3:$W$3)=COLUMNS($E14:E14))*($D$4:$D$10=$D14),SUM($E$4:$W$10*x_)/SUM(1*x_))

按行和列条件计算平均值

注意:let 函数需要 Office 365 兼容性;如果您使用旧版本的 Excel,则省略 let 函数并将 x_ 替换为 (MONTH($E$3:$W$3)=COLUMNS($E14:E14))*($ D$4:$D$10=$D14)...即两个替换...

RE:使用averageifs - @Tom Sharpe 似乎在评论中解决了适用性问题。如果您的目标是使用averageifs来使其工作,那么(尽管有用例) - 您仍然可以使用averageifs,但需要包含index过滤以确保标准和值范围之间的维度一致...

RE: your primary objective:

"work out the average performance by month and by territory"

Format your date headers as date i.e.:

=DATE(2020,1,1)

Date formatted headers

(day is irrelevant)

Next, use following formula to calculate averages (lot's of different ways, this is but one of them...which works as intended):

=LET(x_,(MONTH($E$3:$W$3)=COLUMNS($E14:E14))*($D$4:$D$10=$D14),SUM($E$4:$W$10*x_)/SUM(1*x_))

Calculating average by row and column criteria

Caveat: the let function reqiures Office 365 compatibility; if you have an older version of Excel then omit the let function and substitute x_ with (MONTH($E$3:$W$3)=COLUMNS($E14:E14))*($D$4:$D$10=$D14)...i.e. two substitutions...

RE: using averageifs - @Tom Sharpe appears to have addressesd suitability in commentary. If your objective is fixated upon using averageifs to get this to work then (notwithstanding a use case) - you can still use averageifs but would need to include an index or filter within to ensure dimensionality consistent between criteria and value ranges...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文