Help with a formula

Excelexcel86

Board Regular
Joined
Feb 28, 2023
Messages
99
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
Hi guys someone very kindly managed to help me with the following formula =IF(MEDIAN(MOD(A1,1),TIME(6,0,0),TIME(14,30,0))=MOD(A1,1),"Y","N")

Now this works to an extent but my problem is instead of yes no I’ve I’ve changed the yes to B2-A2 this is because my cells contains dates and times in that are always different so if the two times in cell A and b are in between 06.00 and 14.30 it works but if cell b contains a different date the time formula don’t work as it goes to whatever time is in that cell and outputs the value below is an example of what is happening .so is there an And command I can use with this formula so it also looks to see if both dates are the same as well this would then work as both would be true
01/03/2023 06:3001/03/2023 13.306.00works fine
01/03/202301/03/2023 15:30Over work hours Works fine
02/03/2023 08:0003/03/2023 07:0023.00Don’t work because it’s gone over to 06:00 in the morning it’s calculate over the day
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Is your question if the person has worked overtime/how much overtime?
or just whether the person has started between 0600 and 1430?
My suggestion would be to take a comparison between start day and end day and add 1 to the end time component and subtract the start time component.
or just make sure that the data is an accurate date/time value, then the subtraction of start from end takes days into consideration.
 
Upvote 0
Date and time would be an integer and the decimal portion of the day consistent in BOTH columns.
Either Pure dates (no decimal) in one column with and a pure time (no integer) in another column for both start and end dates (so 4 columns).
 
Upvote 0
Upvote 0
Yes but how would that formula work above for 4 columns if it’s just looking at A and B ? You mean like this in the columns
03/03/202306:3003/03/202316:30
 
Upvote 0
Upvote 0
Hi sorry but you have lost me I’m new to excel my cells are like in the first two cells that’s what I’m asking is there a formula for my cells to check if the dates are the same that goes with my formula at the top of my question
 
Upvote 0
OK. just whenever you see dates acting funny change the format of the cells to GENERAL and see if they have both integers and decimals, only decimals,, or only integers. As long as your cells are consistent you will be good to go.
 
Upvote 0
Yes but how would that formula work above for 4 columns if it’s just looking at A and B ? You mean like this in the columns
03/03/202306:3003/03/202316:30
i did not see this. As long as columns A & C are both date values (no decimal portion) and B & D are time values (no integer portion) you have the foundation for accurate formulas.
 
Upvote 0

Forum statistics

Threads
1,215,301
Messages
6,124,142
Members
449,144
Latest member
Rayudo125

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