Nik_Learning
Nik_Learning

Reputation: 37

List adjacent cell values if date belongs to month 1, 2, 3 (jan, feb, mar...) etc

I have a list of dates in column B and a list of working hours in column C. I would like to get all the values (hours) listed in column D from column C if adjacent cell value in column B belongs to Month 1 (January).

Then I would like to drag the formula downwards and to the right so that column E = February, columnF = March etc.

The answer to column D should be a list with all the hours from column C that are in January in columnB and by dragging the formula down and to the right to get the formula working for all the other Months as well.

Note that the dates might be in disorder!

I've tried with INDEX MATCH but I can't get my different formulas to work with the MONTH() function. I've tried to find an answer to the problem for many hours now without success. All help appreciated.

Upvotes: 0

Views: 395

Answers (1)

Emily Alden
Emily Alden

Reputation: 570

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.

Upvotes: 1

Related Questions