简体   繁体   English

excel year()公式返回错误的年份

[英]excel year() formula returns incorrect year

For some reason the Excel year() formula does not return 2008 as expected! 由于某些原因,Excel year()公式未按预期返回2008

I am using Excel 2016 (offline version) 我正在使用Excel 2016(脱机版本)

Row    C              D                     Formula
1      SourceDate     YearOnly
2      2008/12/01     1905/06/30            =YEAR(C2)

Just realized that the Year() formula returns a Number , however I had column D formatted as a Date 刚意识到Year()公式返回Number ,但是我将D列格式化为Date

Changed this back to number and now I get the correct date as expected! 将其更改回数字,现在我可以按预期获得正确的日期!

I also see that I can retain the Date format on column D but must then reconstruct a full date eg = Date(Year(C2),1,1) 我还看到我可以保留D列上的Date格式,但是必须重新构造一个完整的日期,例如= Date(Year(C2),1,1)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM