问题
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