计算条件SLOPE [英] Computing conditional SLOPE
问题描述
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屋!