Networkdays between 2 dates in different format

qike74

New Member
Joined
Jan 15, 2016
Messages
4
I'm trying to get the difference in hours between two dates which are displayed in a different format (one is in mm/dd/yyyy and the other is in dd/mm/yyyy). Changing the format cell doesn't help.
I'm trying different solutions without being able to succeed. Basically I would like to format the first one to display dd/mm/yyyy to make it work.

here is a sample:

Date Opened Date Closed Formula applied Result
8/1/2015 2:04 PM 14-01-2016 3:35 PM =SUM(((NETWORKDAYS(A2,B2)-1)*24),HOUR(B2-A2)) 6361 (Excel thinks the first is Jan and not August)
1/13/2016 12:04 PM 14-01-2016 3:35 PM =SUM(((NETWORKDAYS(A3,B3)-1)*24),HOUR(B3-A3)) #VALUE! (doesn't recognize 13 as a month I believe)

Any ideas? Thanks!!
 

qike74

New Member
Joined
Jan 15, 2016
Messages
4
It looks like the formatting in the message is quite difficult to read. please find below an easier version to read:

Date Opened
A1) 8/1/2015 2:04 PM
A2) 1/13/2016 12:04 PM

Date Closed
B1) 14-01-2016 3:35 PM
B2) 14-01-2016 3:35 PM

Formula to be applied:
=SUM(((NETWORKDAYS(A,B)-1)*24),HOUR(B-A))

Results:
Line 1: 6361 (Excel thinks the date opened is Jan and not August.)
Line 2: #VALUE! (Excel doesn't recognize 13 as a month I believe)
 

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
7,778
Office Version
365
Platform
Windows
So you have some American dates that you have pasted into an English excel sheet? Can you not convert the dates before they are imported?
 

qike74

New Member
Joined
Jan 15, 2016
Messages
4
I guess I could use the text to column feature but I'm looking for an automated solution so anytime the file is refreshed there is no manual intervention.

In order to simplify things I changed the second date to NOW() as this is the refresh time and will be the same.
However, even formatting the NOW() date to the original American I'm getting the same error.

Here I have uploaded a sample for better visibility:
http.//www.viajablog.com/wp-content/uploads/2016/01/sample.xlsx

It would be so great if anybody could have a look and understand what could be done

Thanks!
Enric
 

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
7,778
Office Version
365
Platform
Windows
You could convert your dates that are text as such. Bear in mind that A2 seems to be incorrect. It closes before it opens!

=DATEVALUE(SUBSTITUTE(REPLACE(A2,1,FIND("/",A2),""),"/","/"&LEFT(A2,FIND("/",A2))))+MOD(MID(A2,FIND(" ",A2)+1,99),1)
 

Forum statistics

Threads
1,081,690
Messages
5,360,614
Members
400,592
Latest member
badgergurl

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top