Present date as first day of the month

扶醉桌前 提交于 2019-12-10 15:14:26

问题


In Google Sheets I'm looking for an array formula to provide the first day of a month for a given date. e.g. If A1 is 1/17/12 20:30 B1 would read 1/1/12 and so on. The formula must keep the date format so that I can sort by date, on column B in this example.


回答1:


I think you could just "compose" a new date using the DATE formula. e.g.

=Date(Year(A1);Month(A1);1)



回答2:


Let me add to contribution from Henrique ...

I can use the following arrayformula in cell B1:

=ArrayFormula(if(A:A,eomonth(A:A,-1)+1,))

where column A holds the dates or timestamps



来源:https://stackoverflow.com/questions/8919637/present-date-as-first-day-of-the-month

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!