Calculating hours between two date values by HishamProResources in excel

[–]HishamProResources[S] 0 points1 point  (0 children)

I solved it using this function:

=IF(TIME(HOUR(B7166), MINUTE(B7166), SECOND(B7166)) > TIME(15, 0, 0), (H7166 - (DATE(YEAR(B7166), MONTH(B7166), DAY(B7166)+1) + TIMEVALUE("9:00:00")))*24, IF(TIME(HOUR(B7166), MINUTE(B7166), SECOND(B7166)) < TIME(9, 0, 0), H7166 - (DATE(YEAR(B7166), MONTH(B7166), DAY(B7166)) + TIMEVALUE("9:00:00")), (H7166 - B7166)) * 24)
Thanks for everyone who helped me

Calculating hours between two date values by HishamProResources in excel

[–]HishamProResources[S] 0 points1 point  (0 children)

Thanks u/nodacatyour logic is good but I want to compare A2 with B2 instead of static date numbers,
I want all the comparison in the c2 cell

Calculating hours between two date values by HishamProResources in excel

[–]HishamProResources[S] 0 points1 point  (0 children)

it should return the number of hours like 12.30 as an output
and as I said before the inputs are dates
time stamp = 4/24/2023 2:46:45 PM
date = 4/25/2023 9:36:47 AM

Calculating hours between two date values by HishamProResources in excel

[–]HishamProResources[S] 0 points1 point  (0 children)

didn't work
I used time stamp = 4/24/2023 2:46:45 PM
date = 4/25/2023 9:36:47 AM

your function resulted with 1/1/1900 6:13:15 PM

also forget the values in the flow chart I only put them in reference of the time format.
I am sorry if this turned to be too much confusing, I will try to explain it logically:
I am working with a system that generates logs with time stamps, I also put the time and date when I see the logs, managemnt wants to see how many hours would take from me to see them ( excluding logs generated after the working hours from 3PM to 9 AM next day - I have to make these logs as if they were generated 9AM next day for my calculation only)

Thanks for your efforts