用excel中的条件选择最大值 [英] Selecting the max with a condition in excel
问题描述
我有一个范围在excel与日期和值
http://lh4.ggpht.com/_i-hI_3gfy08/SoSIopeZUZI/AAAAAAAABEk/KjFnq57VTUc/table.png
编辑:图片添加
我想从每个YEAR的HIGH列中选择MAX值(2009年将返回404,2008将返回390)
$ b $我已经做了类似的事情,但是它使用的是SUMIF,而不是MAX。
这里的任何人都可以帮助我吗?
有三个选项可用。
我的首选选项是创建一个没有一个帮助列。
- 选项1:使用数据透视表
创建数据的枢纽表。
将行设置为date字段,并按年份对其进行分组。
或者,可以通过添加具有该公式的列来使用'Year'帮助列。
= YEAR(A2 )
将数据透视表的数据项值部分设置为 MAX
使用公式添加一个名为year的帮助列
= YEAR(A2)
然后为每年添加公式
= DMAX(A1:C21,高,F13:F14)
- 选项3:使用数组公式
使用 Ctrl-Shift-Enter 键输入每年的数组公式。
{= MAX(IF(YEAR(A2:A21)= 2008,B2:B21))}
I have a range in excel with dates and values
http://lh4.ggpht.com/_i-hI_3gfy08/SoSIopeZUZI/AAAAAAAABEk/KjFnq57VTUc/table.png EDIT:image added
I want to select the MAX value from the HIGH column for each YEAR (2009 would return 404, 2008 would return 390)
I've done something similar but it's using SUMIF, not MAX.
Any excel people in here that can help me out?
There are three options available.
My preferred option is to create a pivot table without a helper column.
- Option 1: Use a pivot table
Create a pivot table of your data.
Set the row to the date field and group it by year. Alternately a 'Year' helper column could be used by adding a column with this formula.
=YEAR(A2)
Set the data items value portion of the pivot table to be the MAX of your 'High' field
- Option 2: Use the DMAX function
Add a helper column titled year with the formula
=YEAR(A2)
Then add a formula for each year
=DMAX(A1:C21,"High",F13:F14)
- Option 3: Use an array formula
Enter an array formula for each year using the Ctrl-Shift-Enter keys.
{=MAX(IF(YEAR(A2:A21)=2008,B2:B21))}
这篇关于用excel中的条件选择最大值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!