计算条件SLOPE [英] Computing conditional SLOPE

查看:109
本文介绍了计算条件SLOPE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的电子表格,其中列A是一堆日期(升序),列B是一串值。查找OLS坡度很容易:

  SLOPE(B2:B161,A2:A161)

但我不想要一切的斜坡。我想看每个月的坡度。所以如果C3是3,我想做一些像:

  SLOPE(IF(MONTH(A2:A161 )== C3,B2:B161),A2:A161)

哪个是错误的,但希望传达我正在努力做什么如何实现这一点?

解决方案

您有正确的想法或多或少。尝试以下操作,但不要仅仅按Enter键将值提交到单元格,请按Control + Shift + Enter(CSE),将其转换为数组公式,使其按照您想要的方式运行。

  = SLOPE(IF(MONTH(A2:A161)= 3,A2:A161),B2:B161)


I have a simple spreadsheet, where column A is a bunch of dates (ascending) and column B is a bunch of values. Finding the OLS slope is easy:

SLOPE(B2:B161,A2:A161)

But I don't want the slope of everything. I want to see the slope for each month. So if C3 is "3", I'd want to do something like:

SLOPE(IF(MONTH(A2:A161)==C3,B2:B161), A2:A161)

Which is wrong, but hopefully conveys what I'm trying to do. How do I actually do this?

解决方案

You've got the right idea more or less. Try the following, but instead of just pressing enter to commit the value to the cell, press Control+Shift+Enter (CSE) which turns it into an array formula and makes it behave the way you'd like.

=SLOPE(IF(MONTH(A2:A161)=3,A2:A161),B2:B161)

这篇关于计算条件SLOPE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆