简体   繁体   中英

Loop over values that satisfy a condition in Excel 2007

I have some basic statistics calculating the min, q1, median, q3, max, iqr, and outliers on an excel spreadsheet. What I have now is a value for the largest acceptable value that wouldn't be an outlier.

So I want to have a formula that says, "The real max is the max of the values given that it is not below the value calculated as something that would be an outlier."

So for example, I have data points: 8, 5, 6, 5, 37, 2. The max is 37 and the highest value that wouldn't be an outlier is 11.25. So obviously 37 is greater than 11.25, so I want my real max to be 8. The formula I'm trying to use is as follows:

=IF(H25>H33, MAX(IF(B15:G15<H33,B15:G15,"")), H25)

where H25 is the calculated max value (in this case 37), H33 is the highest non outlier value (in this case 11.25), and B15:G15 are the 6 data points (8, 5, 6, 5, 37, 2).

So basically I'm trying to do a for loop that either takes the calculated max if it's not an outlier or otherwise loops through the data points and takes the max of the values that aren't outliers. The above formula doesn't work which is my problem and that's what I need help with.

Thanks for any pointers.

So it turns out my formula does work as expected, you simply have to push "Ctrl-Shift-Enter" instead of just "Enter" to make sure it's evaluated as an array formula. It is really annoying but it works (I think Excel should just recognize it's an array formula).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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