Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
273 views
in Technique[技术] by (71.8m points)

date - Excel - how can i use the Filter formula to account for the next month?

i made use of the FILTER formula to bring me data that falls in the same month as TODAY: =FILTER(Data!N2:N22,MONTH(Money!C29)=MONTH(Data!M2:M22))

I'm now trying to do the exact same, except for the next month

i've been toying around with different variations of the EDATE function, but can't get it to work. I keep getting a #CALC! error: =FILTER(Data!N2:N22,EDATE(MONTH(Money!C29),1)=MONTH(Data!M2:M22))

i've also tried this formula, which does return values, but it returns data for all months in my table, as opposed to just next month's:

=FILTER(Data!N2:N22,(MONTH(EDATE(Money!C29,1)=MONTH(Data!M2:M22))))

please let me know if you would like more clarification

**edit - not really sure how to add sample data here

Data Sheet


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You'd want to use EOMONTH function.

For this month, something like (where Dates refers to your column of dates):

=FILTER(myArray,(Dates>EOMONTH(TODAY(),-1))*(Dates<=EOMONTH(TODAY(),0)))

and for next month:

=FILTER(myArray,(Dates>EOMONTH(TODAY(),0))*(Dates<=EOMONTH(TODAY(),1)))

You'll have to replace myArray and Dates with whatever is appropriate for your data.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...