我在B
列中有一个日期列表,在C
列中有一个工作时间列表。如果列D
中的相邻单元格值属于C
,我想从列B
中获取列Month 1 (January)
中列的所有值(小时)。
然后我想将公式向下和向右拖动,以使列E
= February
,列F
= March
等。
第D
列的答案应该是一个列表,其中包含C
一月份的所有小时数在B
列中,并通过向右下方拖动公式来获得该公式也适用于所有其他月份。
请注意,日期可能会混乱!
我尝试使用INDEX MATCH
,但是无法使用MONTH()
函数来使用不同的公式。我已经尝试了好几个小时了,但都没有成功。感谢所有帮助。
答案 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.