如果日期属于第1、2、3月(1月,2月,3月...)等,请列出相邻的单元格值

时间:2019-01-07 13:43:46

标签: excel

我在B列中有一个日期列表,在C列中有一个工作时间列表。如果列D中的相邻单元格值属于C,我想从列B中获取列Month 1 (January)中列的所有值(小时)。

然后我想将公式向下和向右拖动,以使列E = February,列F = March等。

D列的答案应该是一个列表,其中包含C一月份的所有小时数在B列中,并通过向右下方拖动公式来获得该公式也适用于所有其他月份。

请注意,日期可能会混乱!

我尝试使用INDEX MATCH,但是无法使用MONTH()函数来使用不同的公式。我已经尝试了好几个小时了,但都没有成功。感谢所有帮助。

1 个答案:

答案 0 :(得分:1)

Double check that your dates are being read correctly by first putting =MONTH(A2) and ensuring the appropriate value (1 - 12) comes out. Once you have verified that the following should do what you want.

In column D: =IF(MONTH($C2)=1,$B2,"") This formula can be dragged to the right first and replace 1 with 2 - 12 as appropriate for the month. Then copy them down.