简体   繁体   English

Excel 公式生成月份 项目日期

[英]Excel Formula to generate month Date of project

I'm working with a sales pipeline sheet and need a formula to generate the project start and end months based on invoice charges inputted in month columns.我正在使用销售管道表,需要一个公式来根据月份列中输入的发票费用生成项目开始和结束月份。 For example if a client delays a project and invoice months change, I'd ideally like the Project start and end month to update automatically as I update invoice months.例如,如果客户延迟项目并且发票月份发生变化,我希望项目开始和结束月份在我更新发票月份时自动更新。

For example if I was to move 2000 and 1000 on the table below (row 1) to the Apr & May columns respectively, the formula would update Project start to Apr, and Project end to May.例如,如果我要将下表(第 1 行)上的 2000 和 1000 分别移动到 Apr 和 May 列,则公式会将 Project start 更新为 Apr,Project end 更新为 May。

Project start项目启动 Project end项目结束 Jan Feb二月 Mar三月 Apr四月 May可能
Jan Feb二月 2000 2000 1000 1000
Jan April四月 1000 1000 1000 1000 1000 1000 1000 1000
[forumula to generate feb?] [生成二月的公式?] [forumla to generate May?] [生成May的论坛?] 500 500 500 500 500 500 500 500 500 500

I would advise you to use the following cell formatting for the dates of your project (cell formatting, Custom):我建议您对项目日期使用以下单元格格式(单元格格式,自定义):

mmm

In order to get to the next month, you can use the following formula:为了到达下个月,您可以使用以下公式:

=MONTH(DATEVALUE(DAY(B8)&"/"&MONTH(B8)+1&"/"&YEAR(B8)))

This takes the day, the month plus one and the year, and converts this into a new date from which the cell formatting will just show you the month.这需要日、月加一和年,并将其转换为新日期,单元格格式将从该日期开始向您显示月份。 Be careful: this only works while working within the same year.请注意:这仅在同一年内工作时有效。 In case you jump from December to January the next year, you need an IF() function to make this work.如果你从 12 月跳到明年 1 月,你需要一个IF() function 来完成这项工作。

You can use these formulas for the start and end date - if you have Excel 365您可以将这些公式用于开始和结束日期 - 如果您有 Excel 365

=INDEX($A$1:$G$1, MIN(FILTER(COLUMN(D2:G2),D2:G2<>"")))

=INDEX($A$1:$G$1, MAX(FILTER(COLUMN(D2:G2),D2:G2<>"")))

  • COLUMN(D2:G2) returns an array with the column indices of the invoice amounts. COLUMN(D2:G2)返回一个包含发票金额列索引的数组。
  • FILTER only returns those column indices that have an amount FILTER仅返回具有数量的列索引
  • and finally MIN and MAX return the first and last column index最后MINMAX返回第一列和最后一列索引
  • this is then passed to INDEX on the header row.然后将其传递给 header 行上的 INDEX。

在此处输入图像描述

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

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