# Excel: I need a formula that will count months between two dates. If it's 1-15 it should be a half month. Any ideas?

So I am trying to find a formula for excel. Bascically I have two dates and I need to know the number of months between them. But to add complexity, I need a rule in there that if the earlier date is the 1st to 15th it will be a whole month but if it is 16th to end of the month it will be a half month.

For example: Date 1: April 4, 2012 Date 2: December 31, 2012 Answer: Number of months would be 9 months

If Date 1 was April 16, 2012, with the same Date 2 of December 31, 2012, then the number of months would equal 8.5.

Can anyone help me with this one? You help would be greatly appreciated. many thanks

-

## migrated from stackoverflow.comJan 17 '13 at 16:04

This question came from our site for professional and enthusiast programmers.

Not a programming question. should have been asked at Super User – brettdj Jan 17 '13 at 7:24

``````=DATEDIF(G8, H8, "m") +1 -IF(DAY(G8) <16,0, 0.5)