ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   time calculation using IF function (https://www.excelbanter.com/excel-worksheet-functions/121103-time-calculation-using-if-function.html)

Polly

time calculation using IF function
 
I am trying to write a function that calculates a time card

I want to "say" that if you punch in between 8:00 am and 8:08 am, the time
will read 8:00 am, if it is 8:09 am, then the time will read 8:15 am.

I tried: c11<=08:08, 8:00 am, 8:15 am but it does not work.

Any thoughts?

daddylonglegs

time calculation using IF function
 
Well, you could try

=IF(C11<="08:08"+0,"8:00"+0,"8:15"+0)

format as h:mm AM/PM

but what happens if c11 is 07:00 or 09:00? I know it won't give quite the
same result but what about

=ROUND(C11*96,0)/96

to round to the nearest quarter hour

"Polly" wrote:

I am trying to write a function that calculates a time card

I want to "say" that if you punch in between 8:00 am and 8:08 am, the time
will read 8:00 am, if it is 8:09 am, then the time will read 8:15 am.

I tried: c11<=08:08, 8:00 am, 8:15 am but it does not work.

Any thoughts?


Polly

time calculation using IF function
 
Thank you! The rounding work great.

I really appreciate your help.

Polly

"daddylonglegs" wrote:

Well, you could try

=IF(C11<="08:08"+0,"8:00"+0,"8:15"+0)

format as h:mm AM/PM

but what happens if c11 is 07:00 or 09:00? I know it won't give quite the
same result but what about

=ROUND(C11*96,0)/96

to round to the nearest quarter hour

"Polly" wrote:

I am trying to write a function that calculates a time card

I want to "say" that if you punch in between 8:00 am and 8:08 am, the time
will read 8:00 am, if it is 8:09 am, then the time will read 8:15 am.

I tried: c11<=08:08, 8:00 am, 8:15 am but it does not work.

Any thoughts?


Teethless mama

time calculation using IF function
 


"Polly" wrote:

I am trying to write a function that calculates a time card

I want to "say" that if you punch in between 8:00 am and 8:08 am, the time
will read 8:00 am, if it is 8:09 am, then the time will read 8:15 am.

I tried: c11<=08:08, 8:00 am, 8:15 am but it does not work.

Any thoughts?


Teethless mama

time calculation using IF function
 
=IF(MINUTE(A1)<9,TIME(HOUR(A1),,),TIME(HOUR(A1),15 ,))

Format as h:mm AM/PM

"Polly" wrote:

I am trying to write a function that calculates a time card

I want to "say" that if you punch in between 8:00 am and 8:08 am, the time
will read 8:00 am, if it is 8:09 am, then the time will read 8:15 am.

I tried: c11<=08:08, 8:00 am, 8:15 am but it does not work.

Any thoughts?



All times are GMT +1. The time now is 01:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com