简体   繁体   English

每月平均体重 - 图表 - Google 表格

[英]Average weight per month - Graph - Google Sheet

I have a dataset with weight on specific dates:我有一个特定日期的权重数据集:

数据集

I have already made a graph of this, but I find it a little bit confusing:我已经制作了一张图表,但我觉得它有点混乱:

图形

There are no system when the measurement have been taken place.进行测量时没有系统。 Meaning in some months there are a lot of data, and other months there are just 2,3 or even 0. So I want to turn this into average per month.意思是有些月份有很多数据,而其他月份只有 2,3 甚至 0。所以我想把它变成每月的平均值。 I have found a way to get the data into average per month:我找到了一种将数据转换为每月平均值的方法:

Combinding ArrayFormula:结合 ArrayFormula:

=ARRAYFORMULA(IF(A3:A71 <> ""; YEAR(A3:A71) & "/" & MONTH(A3:A71); ""))

With Query:随着查询:

=QUERY(A3:C64;"select C, avg(B) where C != '' group by C order by C"; 0)

Which outputs the following:输出以下内容:

2020/10 81,6
2020/11 78,9
2020/12 77,4
2020/7  87,2
2020/9  83,4
2021/1  78,0
2021/3  75,6
2021/4  77,9
2021/5  79,6
2021/7  82,6
2021/8  82,3
2021/9  81,0

But there are at least two problems:但至少存在两个问题:

  1. It is not sorted correctly它没有正确排序
  2. I am not able to make a graph of it as this is not formatted by date.我无法制作它的图表,因为它不是按日期格式化的。

Any ideas how I can solve this problem succesfully?有什么想法可以成功解决这个问题吗? Can it be solved by ArrayFormula?可以用ArrayFormula解决吗?

Please take a look at the spreadsheet:请看一下电子表格:

https://docs.google.com/spreadsheets/d/1tcWMZZGL7MwJSJgqLlIVNghD-WiJEZJa8xO4mRrhF6A/edit?usp=sharing https://docs.google.com/spreadsheets/d/1tcWMZZGL7MwJSJgqLlIVNghD-WiJEZJa8xO4mRrhF6A/edit?usp=sharing

Try this in cell D2:在单元格 D2 中试试这个:

=arrayformula(query({eomonth(A2:A;0)\B2:B};"select Col1,avg(Col2) where Col2 is not null group by Col1 label Col1 'Month'";1))

Set the chart range to D1:E64 .将图表范围设置为D1:E64

You can format ColD to be 'mmm yy' or whatever you need.您可以将 ColD 格式化为 'mmm yy' 或任何您需要的格式。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM