Friday, 27 September 2019

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



Answer



Assuming the dates are in G8, H8


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

enter image description here


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...