Help on hour difference

sksanjeev786

Well-known Member
Joined
Aug 5, 2020
Messages
879
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello Team,

I have an office timing from 9:00A M to 6:00 PM excluding Sat and Sun.

I need a different hour mention in the below sheet. and calculation need between office timeing


Due DateDeliverDiff hour with in 9:6 PM
9/4/2020 21:309/3/2020 11:007:30 hr
9/3/2020 9:309/2/2020 15:303 hr
9/2/2020 11:509/2/2020 10:501 hr
9/7/2020 11:009/4/2020 17:003 hr
 

sksanjeev786 Ok we are going to start out slow and build on it. Now I have picked dates and times that are simple. Once you agree to these examples we can go to the next level. We will pick dates and times that won't work with these formulas and come up with more formulas that will work. I want to also bring up cell formatting. Format Columns A & B using below custom format


1603058658756.png


Format Columns C, E & F with

1603058769781.png


With any luck, maybe one of the A Students will look at this problem and come up with more solutions.



20-10-18 time1.xlsx
ABCDEF
1Due DateDeliverDiff hour with in 9:6 PMDue CalculationDeliver Calculation
2Thu 9/17/2020 17:30Wed 9/16/2020 11:0015:308:307:00
3Wed 9/23/2020 15:15Tue 9/22/2020 11:4512:306:156:15
4Wed 10/7/2020 16:15Tue 10/6/2020 13:4511:307:154:15
Diff Hour
Cell Formulas
RangeFormula
E2:E4E2=TEXT(A2,"h:mm")-TEXT("9:00 AM","h:mm")
F2:F4F2=TEXT("6:00 PM","h:mm")-TEXT(B2,"h:mm")
C2:C4C2=E2+F2
 
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

sksanjeev786 Ok we are going to start out slow and build on it. Now I have picked dates and times that are simple. Once you agree to these examples we can go to the next level. We will pick dates and times that won't work with these formulas and come up with more formulas that will work. I want to also bring up cell formatting. Format Columns A & B using below custom format


View attachment 24428

Format Columns C, E & F with

View attachment 24430

With any luck, maybe one of the A Students will look at this problem and come up with more solutions.



20-10-18 time1.xlsx
ABCDEF
1Due DateDeliverDiff hour with in 9:6 PMDue CalculationDeliver Calculation
2Thu 9/17/2020 17:30Wed 9/16/2020 11:0015:308:307:00
3Wed 9/23/2020 15:15Tue 9/22/2020 11:4512:306:156:15
4Wed 10/7/2020 16:15Tue 10/6/2020 13:4511:307:154:15
Diff Hour
Cell Formulas
RangeFormula
E2:E4E2=TEXT(A2,"h:mm")-TEXT("9:00 AM","h:mm")
F2:F4F2=TEXT("6:00 PM","h:mm")-TEXT(B2,"h:mm")
C2:C4C2=E2+F2


Hi Sir,

while applying the above formula i am getting error in the formula as i have used same both formate you have shown above.

Due DateDeliverDiff hour with in 9:6 PMDue CalculationDeliver Calculation
Thu 9/17/2020 17:30Wed 9/16/2020 11:00#VALUE!#VALUE!#VALUE!
Wed 9/23/2020 15:15Tue 9/22/2020 11:45#VALUE!#VALUE!#VALUE!
Wed 10/7/2020 16:15Tue 10/6/2020 13:45#VALUE!#VALUE!#VALUE!


Regards,
Sanjeev.
 
Upvote 0
Sanjeev. I don't understand why your XL2BB looks so much different than mine. We need to work on this. I need to see which rows and columns you are using. I need to see which formulas are in which cells. So when you use MrExcel tab, don't forget to select the area you want to copy, and check that box Cell Formulas. Let me ask you, do you understand the formulas in the cells I have posted above?
 
Upvote 0
Thank you Fluff. The limits to my ignorance is unlimited.
 
Upvote 0
Hi Sir,

Sorry for the below formate as suggested I have taken the formate and also apply the same formate above screenshot and getting an error as per the below table



MR Excel_1016.xlsx
ABCDEF
1Due DateDeliverDiff hour with in 9:6 PMDue CalculationDeliver Calculation
2Thu 9/17/2020 17:30Wed 9/16/2020 11:00#VALUE!#VALUE!#VALUE!
3Wed 9/23/2020 15:15Tue 9/22/2020 11:45#VALUE!#VALUE!#VALUE!
4Wed 10/7/2020 16:15Tue 10/6/2020 13:45#VALUE!#VALUE!#VALUE!
Sheet1
Cell Formulas
RangeFormula
E2:E4E2=TEXT(A2,"h:mm")-TEXT("9:00 AM","h:mm")
F2:F4F2=TEXT("6:00 PM","h:mm")-TEXT(B2,"h:mm")
C2:C4C2=E2+F2

Sanjeev. I don't understand why your XL2BB looks so much different than mine. We need to work on this. I need to see which rows and columns you are using. I need to see which formulas are in which cells. So when you use MrExcel tab, don't forget to select the area you want to copy, and check that box Cell Formulas. Let me ask you, do you understand the formulas in the cells I have posted above?
Sanjeev. I don't understand why your XL2BB looks so much different than mine. We need to work on this. I need to see which rows and columns you are using. I need to see which formulas are in which cells. So when you use MrExcel tab, don't forget to select the area you want to copy, and check that box Cell Formulas. Let me ask you, do you understand the formulas in the cells I have posted above?
 
Upvote 0

sksanjeev786 Ok here is the deal. We have to focus on columns A & B. In my opinion, formatting can be very difficult. I believe that you can input data and it looks like a date but it isn't. You can even try and change the format but no joy. Select cell data in column A and try to switch it to Text. Like the example below, it should change to a number. If it doesn't change to a number then it isn't formatted correctly. The only thing I can suggest is to start with a new workbook and format columns A & B with that custom formatting. We will get this.



Book1
ABCDEF
1Due DateDeliver
2Wed 9/18/2024 17:30Tue 9/17/2024 10:0016:308:308:00
344097.63542Mon 9/23/2024 11:45
4Tue 10/8/2024 16:15Mon 10/7/2024 13:45
Sheet4
Cell Formulas
RangeFormula
C2C2=E2+F2
E2E2=TEXT(A2,"h:mm")-TEXT("9:00 AM","h:mm")
F2F2=TEXT("6:00 PM","h:mm")-TEXT(B2,"h:mm")

 
Upvote 0

sksanjeev786 Ok here is the deal. We have to focus on columns A & B. In my opinion, formatting can be very difficult. I believe that you can input data and it looks like a date but it isn't. You can even try and change the format but no joy. Select cell data in column A and try to switch it to Text. Like the example below, it should change to a number. If it doesn't change to a number then it isn't formatted correctly. The only thing I can suggest is to start with a new workbook and format columns A & B with that custom formatting. We will get this.



Book1
ABCDEF
1Due DateDeliver
2Wed 9/18/2024 17:30Tue 9/17/2024 10:0016:308:308:00
344097.63542Mon 9/23/2024 11:45
4Tue 10/8/2024 16:15Mon 10/7/2024 13:45
Sheet4
Cell Formulas
RangeFormula
C2C2=E2+F2
E2E2=TEXT(A2,"h:mm")-TEXT("9:00 AM","h:mm")
F2F2=TEXT("6:00 PM","h:mm")-TEXT(B2,"h:mm")



Hi Sir,

I check now and it works for me and I have removed Wed and Tue from the cell and then I got the hours details.

Thank you so much for your help and I will check again and will get back to you again if I need any support.

Thank you once again, sir.
Sanjeev
 
Upvote 0
Glad to help. Now if you want to continue on, let us know
 
Upvote 0

Forum statistics

Threads
1,214,548
Messages
6,120,146
Members
448,948
Latest member
spamiki

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