ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Difference between two dates rounded up. (https://www.excelbanter.com/excel-worksheet-functions/137627-difference-between-two-dates-rounded-up.html)

Megan

Difference between two dates rounded up.
 
I would like to calculate the difference in two dates but in weeks. However
if the result is less than 1 week I would like the result rounded up to 1
week. Can anyone help I have had numerous attempts.

Mike

Difference between two dates rounded up.
 
=IF(DATEDIF(A1,B1,"d")/7<1,1,DATEDIF(A1,B1,"d")/7)

Try this. Note that it will only round up the first week, weeks greater than
1 will be a decimal.

Mike

"megan" wrote:

I would like to calculate the difference in two dates but in weeks. However
if the result is less than 1 week I would like the result rounded up to 1
week. Can anyone help I have had numerous attempts.


macropod

Difference between two dates rounded up.
 
Hi Megan,

Assuming the dates are in A1 & A2, with A2 holding the later date:
=ROUNDUP((A2-A1)/7,0)
will round up the count of weeks to the next nearest week if less than a whole week. If you only want the first week rounded up,
try:
=MAX(1,ROUND((A2-A1)/7,0))

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

"megan" wrote in message ...
I would like to calculate the difference in two dates but in weeks. However
if the result is less than 1 week I would like the result rounded up to 1
week. Can anyone help I have had numerous attempts.



Megan

Difference between two dates rounded up.
 
Thank you so much. That works perfectly.

"Mike" wrote:

=IF(DATEDIF(A1,B1,"d")/7<1,1,DATEDIF(A1,B1,"d")/7)

Try this. Note that it will only round up the first week, weeks greater than
1 will be a decimal.

Mike

"megan" wrote:

I would like to calculate the difference in two dates but in weeks. However
if the result is less than 1 week I would like the result rounded up to 1
week. Can anyone help I have had numerous attempts.


Megan

Difference between two dates rounded up.
 
Thanks. This works much better as with the other formula I was having
problems when the dates were the same. Thanks again.

"macropod" wrote:

Hi Megan,

Assuming the dates are in A1 & A2, with A2 holding the later date:
=ROUNDUP((A2-A1)/7,0)
will round up the count of weeks to the next nearest week if less than a whole week. If you only want the first week rounded up,
try:
=MAX(1,ROUND((A2-A1)/7,0))

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

"megan" wrote in message ...
I would like to calculate the difference in two dates but in weeks. However
if the result is less than 1 week I would like the result rounded up to 1
week. Can anyone help I have had numerous attempts.





All times are GMT +1. The time now is 08:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com