选择一行中的单元格,基于今天在列A中匹配的月份和年份。

huangapple go评论49阅读模式
英文:

Select a cell in row based on today's matching month & year in column A

问题

这是表格:

A B C
2023年1月 5
2023年2月 10
2023年3月 15
2023年4月 20
2023年5月 25
2023年6月 30
2023年7月 35
2023年8月 40

今天的日期是2023年4月

我正在尝试创建一个查询,当列A与今天匹配时,获取列C中的数字。

这是我尝试的内容:

=QUERY(A1:C8,"select C where A = date '"&TEXT(EOMONTH(TODAY(),-1)+1,"yyyy-mm-dd")&"'",1)

但这返回的是5(第一行),而我预期的是20。我该如何修改这个查询?

英文:

Here's the sheet

A B C
Jan 2023 5
Feb 2023 10
Mar 2023 15
Apr 2023 20
May 2023 25
Jun 2023 30
Jul 2023 35
Aug 2023 40

Todays date is in April 2023

I'm trying to make a query that grabs the number in column C when column A matches TODAY.

Here's what I attempted:

=QUERY(A1:C8,"select C where A = date '"&TEXT(EOMONTH(TODAY(),-1)+1,"yyyy-mm-dd")&"'",1)

but this returns 5 (which is the first row) when I'm expecting 20. How can I modify this?

答案1

得分: 1

=QUERY(A1:C8,"select C where A = date '"&TEXT(EOMONTH(TODAY(),-1)+1,"yyyy-mm-dd")&"'",0)

OR

=filter(C:C,eomonth(A:A,)=eomonth(today(),))

英文:

You may try:

=QUERY(A1:C8,"select C where A = date '"&TEXT(EOMONTH(TODAY(),-1)+1,"yyyy-mm-dd")&"'",0)

OR

=filter(C:C,eomonth(A:A,)=eomonth(today(),))

选择一行中的单元格,基于今天在列A中匹配的月份和年份。

huangapple
  • 本文由 发表于 2023年4月20日 02:48:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/76057909.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定