简体   繁体   English

数值范围内子集的Excel最小值/最大值

[英]Excel Min/Max on subset within range of values

I have a excel sheet containing two columns of data, I need formulae that will return the min&max value in column2 where value in column1 is within a range (given date) 我有一个包含两列数据的Excel工作表,我需要一些公式,这些公式将返回column2中的最小和最大值,其中column1中的值在一定范围内(给定日期)

ie for 03/04/2013 min would be 428.80, max would be 431.40 即,对于03/04/2013,最小值为428.80,最大值为431.40

Date&Time               Value
===================     ======
02/04/2013 10:15:05     429.10
02/04/2013 12:37:42     429.30
03/04/2013 15:45:00     430.50
03/04/2013 15:50:00     429.70
03/04/2013 15:55:00     428.80    <== Min
03/04/2013 16:00:00     429.40
03/04/2013 16:05:00     429.50
03/04/2013 16:10:00     429.60
03/04/2013 16:15:00     429.80    <== Max
03/04/2013 16:20:00     429.60
03/04/2013 16:25:00     430.40
03/04/2013 16:50:12     431.40
03/04/2013 17:10:01     429.60
04/04/2013 08:20:00     431.88
04/04/2013 08:25:00     431.70
04/04/2013 08:30:00     431.30
04/04/2013 08:35:00     430.90
04/04/2013 08:40:00     430.70
04/04/2013 08:45:00     429.90
04/04/2013 08:50:00     429.10
04/04/2013 09:00:00     429.50

Your help is much appreciated. 非常感谢您的帮助。 Thanks 谢谢

assuming your date is in column A and values are all positive and is in column B, create column C which contains 1 if A is in range and 0 is not in range. 假设您的日期在A列中,并且值都是正数,并且在B列中,则创建C列,如果A处于范围内,而0不在范围内,则该列包含1。 Then create column D which has formula =B2*C2 and find =max(D:D) for maximum among selected For minimum, put formula =C2/B2 in column E, and calculate minimum among selected as =1/max(E:E) 然后创建具有公式= B2 * C2的D列,并在选定的最大值中找到= max(D:D)对于最小值,将公式= C2 / B2放在E列中,然后将选定的最小值作为= 1 / max(E: E)

If your date criteria, eg 03/04/2013 is in D2 then with date/time values in A2:A100 and numeric values in B2:B100 you can use an "array formula" like this in E2 如果您的日期条件(例如03/04/2013)在D2中,则日期/时间值在A2:A100中,数字值在B2:B100中,则可以在E2中使用这样的“数组公式”

=IFERROR(SMALL(IF(INT(A$2:A$100)=D2,B$2:B$100),1),"No match")

confirmed with CTRL + SHIFT + ENTER so that curly braces like { and } appear automatically around the formula 使用CTRL + SHIFT + ENTER确认,以便{和}之类的花括号自动出现在公式周围

that gives the MIN value, replace SMALL with LARGE for MAX value 给出MIN值,将MAXALL替换为LARGE以获得MAX值

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

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