如何在Google表格中按每周的平均值?

huangapple go评论51阅读模式
英文:

How to Average by day of week in Google Sheets?

问题

给定一个日期和值的表格。

如何按星期几平均?

我发现使用 AVERAGEIF 平均和 TEXT(E4, "dddd") 转换为星期几。

但如何结合这两个函数?

日期 数值
1/1/2001 1
1/2/2001 2
1/3/2001 3
1/4/2001 3
1/5/2001 6
1/6/2001 3
星期几 平均
星期日
星期一
星期二
星期三
星期四
星期五
星期六
英文:

Given a table of dates and values.

如何在Google表格中按每周的平均值?

How to average by day of week?

如何在Google表格中按每周的平均值?

I found AVERAGEIF to average and TEXT(E4, "dddd") to convert to day of week.

But how to combine those two functions?

Date Value
1/1/2001 1
1/2/2001 2
1/3/2001 3
1/4/2001 3
1/5/2001 6
1/6/2001 3
Day of Week Average
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday

答案1

得分: 3

使用QUERY()函数。尝试-

=QUERY({INDEX(TEXT(A1:A15,"dddd")),B1:B15},
"select Col1, avg(Col2) group by Col1 label Col1 'Day', avg(Col2) 'Average'")

要使其动态,请使用-

=QUERY({INDEX(TEXT(TOCOL(A1:A,1),"dddd")),TOCOL(B1:B,1)},
"select Col1, avg(Col2) group by Col1 label Col1 'Day', avg(Col2) 'Average'")
英文:

Go with QUERY() function. Try-

=QUERY({INDEX(TEXT(A1:A15,"dddd")),B1:B15},
"select Col1, avg(Col2) group by Col1 label Col1 'Day', avg(Col2) 'Average'")

To make it dynamic, use-

=QUERY({INDEX(TEXT(TOCOL(A1:A,1),"dddd")),TOCOL(B1:B,1)},
"select Col1, avg(Col2) group by Col1 label Col1 'Day', avg(Col2) 'Average'")

如何在Google表格中按每周的平均值?

huangapple
  • 本文由 发表于 2023年2月14日 09:18:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/75442635.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定