简体   繁体   English

EXCEL:将日期范围从几个月到最后一个月

[英]EXCEL: Change dates that occur in a range across months into the last month of the range

I work for a retail company, and receive a daily excel report including all SKUs on order and their 'ship date', which can span any day of the month. 我在一家零售公司工作,并且每天收到一份excel报告,其中包括订购的所有SKU及其“发货日期”,该报告可能跨越一个月的任何一天。 What I need to do is generalize these ship dates into "delivery months", or what month we will actually receipt the goods at our fulfillment center. 我需要做的是将这些发货日期概括为“交货月份”,或者我们实际在配送中心接收货物的月份。 So for example, any SKU with a ship date falling between 1/15/17 and 2/15/17 would have a delivery month of 2/17, etc. 因此,例如,发货日期在1/15/17到2/15/17之间的任何SKU的交货月份都将是2/17,依此类推。

I've tried playing around with the Month() function but haven't gotten anywhere. 我尝试过使用Month()函数,但是还没到任何地方。

Or you can try something like this 或者你可以尝试这样的事情

In B2 在B2中

=IF(DAY(A2)<=15,EOMONTH(A2,-1)+1,EOMONTH(A2,0)+1)

With data in column A , in B1 enter: 对于A列中数据,在B1中输入:

=IF(DAY(A1)<15,DATE(YEAR(A1),MONTH(A1),1),DATE(YEAR(A1),MONTH(A1)+1,1))

and copy down: 并抄下来:

在此处输入图片说明

Format column B to suit your needs. 格式化B列以适合您的需求。

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

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