how to check date difference in excel

springran

Board Regular
Joined
Mar 18, 2014
Messages
56
Office Version
  1. 365
Platform
  1. Windows
Hi there,

In A1 I have 01.05.2017 in B1 I have a formula which show a date ( this date come from other filed). what formula should I use to calculate difference between A1 and B2?

thanks
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
sorry that's not working :(
In B1 I have a formula (IF(IFERROR(SEARCH("manually",S2,1),0)=1, MID(S2,FIND(" ",S2,1),9), "")) which shows a date in B1.
 
Upvote 0
Try this :

=(IF(IFERROR(SEARCH("manually",S2,1),0)=1, DATEVALUE(MID(S2,FIND(" ",S2,1),9)), ""))

and formate B1 as Date
 
Upvote 0
I guess the formula is for B1 and I need to change formate as date. I have tried to use this formula in B1. it's not working.
let me clarify bit more ;)
I manually type different sentences in S2. so in B2 It has a formula IF(IFERROR(SEARCH("manually",S2,1),0)=1, MID(S2,FIND(" ",S2,1),9), "") which take date from S2. In my A2 I have date as well ( no formula).
Now I want a formula to check how many days between A2 and B2.
 
Upvote 0
in S2
[TABLE="width: 257"]
<tbody>[TR]
[TD]Manually 26.07.17[/TD]
[/TR]
</tbody><colgroup><col></colgroup>[/TABLE]
ASN 07.07.17. location. 2 way
[TABLE="width: 257"]
<tbody>[TR]
[TD]Manually 28.06.17.PO line[/TD]
[/TR]
</tbody><colgroup><col></colgroup>[/TABLE]
 
Upvote 0
Try This
=DATE("20"&RIGHT(RIGHT(S2,LEN(S2)-SEARCH(" ",S2,1)),2),MID(RIGHT(S2,LEN(S2)-SEARCH(" ",S2,1)),4,2),LEFT(RIGHT(S2,LEN(S2)-SEARCH(" ",S2,1)),2))

Then Take Difference
 
Upvote 0
Try This
=DATE("20"&RIGHT(RIGHT(S2,LEN(S2)-SEARCH(" ",S2,1)),2),MID(RIGHT(S2,LEN(S2)-SEARCH(" ",S2,1)),4,2),LEFT(RIGHT(S2,LEN(S2)-SEARCH(" ",S2,1)),2))

Then Take Difference

HI SyedUsman

this only works if the date is last entry. for example ASN 01.02.17 or manually 15.02.17
if I have something after the date. the formulas is not working. for example ASN 19.08.17. Location.PO (this in one filed). it will return as #value .
 
Upvote 0
=date("20"&right(right(if(len(mid(s2,max(1,find(".",s2)-3),11))=9,(mid(s2,max(1,find(".",s2)-3),11)),substitute((mid(s2,max(1,find(".",s2)-3),11)),".","",3)),len(if(len(mid(s2,max(1,find(".",s2)-3),11))=9,(mid(s2,max(1,find(".",s2)-3),11)),substitute((mid(s2,max(1,find(".",s2)-3),11)),".","",3)))-search(" ",if(len(mid(s2,max(1,find(".",s2)-3),11))=9,(mid(s2,max(1,find(".",s2)-3),11)),substitute((mid(s2,max(1,find(".",s2)-3),11)),".","",3)),1)),2),mid(right(if(len(mid(s2,max(1,find(".",s2)-3),11))=9,(mid(s2,max(1,find(".",s2)-3),11)),substitute((mid(s2,max(1,find(".",s2)-3),11)),".","",3)),len(if(len(mid(s2,max(1,find(".",s2)-3),11))=9,(mid(s2,max(1,find(".",s2)-3),11)),substitute((mid(s2,max(1,find(".",s2)-3),11)),".","",3)))-search(" ",if(len(mid(s2,max(1,find(".",s2)-3),11))=9,(mid(s2,max(1,find(".",s2)-3),11)),substitute((mid(s2,max(1,find(".",s2)-3),11)),".","",3)),1)),4,2),left(right(if(len(mid(s2,max(1,find(".",s2)-3),11))=9,(mid(s2,max(1,find(".",s2)-3),11)),substitute((mid(s2,max(1,find(".",s2)-3),11)),".","",3)),len(if(len(mid(s2,max(1,find(".",s2)-3),11))=9,(mid(s2,max(1,find(".",s2)-3),11)),substitute((mid(s2,max(1,find(".",s2)-3),11)),".","",3)))-search(" ",if(len(mid(s2,max(1,find(".",s2)-3),11))=9,(mid(s2,max(1,find(".",s2)-3),11)),substitute((mid(s2,max(1,find(".",s2)-3),11)),".","",3)),1)),2))
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,201
Members
453,022
Latest member
RobertV1609

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top