[英]Matching a month and year of a date to a row of dates
I want to match a start date by month and year (regardless of the day) to a corresponding date that is a column header and return the column number of said date.我想按月和年(无论是哪一天)将开始日期与相应的日期(即 header 列)匹配,并返回所述日期的列号。
Name Start Date 1/7/2015 2/9/2016 4/25/2016
------- ------------ ---------- ---------- -----------
Steve 1/8/2015 100 350 700
Amy 2/2/2016 N/A 250 412
The code I have tried is:我试过的代码是:
MATCH(1,(MONTH(B2)=MONTH($C$1:$E$1))*(YEAR(B2)=YEAR($C$1:$E$1)),0)
The response is "#Value" when it should return "1" for Steve and "2" for Amy.当它应该为史蒂夫返回“1”和为艾米返回“2”时,响应为“#Value”。
As per my comment;根据我的评论; this is an array formula.
这是一个数组公式。 So either:
所以要么:
Add in an additional INDEX
, like so:添加一个额外的
INDEX
,如下所示:
=MATCH(1,INDEX((MONTH(B2)=MONTH($C$1:$E$1))*(YEAR(B2)=YEAR($C$1:$E$1)),),0)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.