Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
DonB
 
Posts: n/a
Default Using an IF statement on time based data

I have a worksheet of payroll time data by date that i want to identify
overtime amounts in excess of 8 hours. I can't seem to write an IF statement
that correctly answers the question "If 8 hours or more, enter 8 hours, if
less then the the calculated time. It seems to be a formatting problem of
moving from time formats to number formats. HELP.
Thanks
--
DonB
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Using an IF statement on time based data

=MIN(A1,TIME(8,0,0))

would be one way (with the time worked in A1)

DonB wrote:

I have a worksheet of payroll time data by date that i want to identify
overtime amounts in excess of 8 hours. I can't seem to write an IF statement
that correctly answers the question "If 8 hours or more, enter 8 hours, if
less then the the calculated time. It seems to be a formatting problem of
moving from time formats to number formats. HELP.
Thanks
--
DonB


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave O
 
Posts: n/a
Default Using an IF statement on time based data

Seems like you should be able to do this with an IF function, assuming
you have cells that contain a start time and an end time. For example
if the start time is in A2 and the end time is in B2, you could use
this formula
=IF(B2-A2=8/24,8,B2-A2)
.... where A2 and B2 are Excel time entries.

  #4   Report Post  
Posted to microsoft.public.excel.misc
DonB
 
Posts: n/a
Default Using an IF statement on time based data

I guess that I am not explaining the problem very well. There are six
columns of data representing the beginning and ending times for the morning,
afternoon, and evening time frames. I have no problem in calculating the
total time worked. However, when I apply an IF statement against the total
to determine if overtime has been worked, the result is .46875 every time.
My equation is
=if(((d12-c12)+(f12-e12)+(h12-g12))=8,8,(d12-c12)+(f12-e12)+(h12-g12)). I
have tried different formattings without success.
--
DonB


"Dave Peterson" wrote:

=MIN(A1,TIME(8,0,0))

would be one way (with the time worked in A1)

DonB wrote:

I have a worksheet of payroll time data by date that i want to identify
overtime amounts in excess of 8 hours. I can't seem to write an IF statement
that correctly answers the question "If 8 hours or more, enter 8 hours, if
less then the the calculated time. It seems to be a formatting problem of
moving from time formats to number formats. HELP.
Thanks
--
DonB


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.misc
DonB
 
Posts: n/a
Default Using an IF statement on time based data

I guess I didn't explain my problem very well. I have six colums of data
which have the daily beginning and ending times for the morning, afternoon,
and evening shifts of an employee. I want an IF statement that says if the
total time is 8 or more hours, the result is 8, else the total time spent.
The various permutations that I have tried return the result .46875 or an
error message. The problem seems to mixing time and number formats but I
can't be sure. Thanks for the reply.
--
DonB


"Dave Peterson" wrote:

=MIN(A1,TIME(8,0,0))

would be one way (with the time worked in A1)

DonB wrote:

I have a worksheet of payroll time data by date that i want to identify
overtime amounts in excess of 8 hours. I can't seem to write an IF statement
that correctly answers the question "If 8 hours or more, enter 8 hours, if
less then the the calculated time. It seems to be a formatting problem of
moving from time formats to number formats. HELP.
Thanks
--
DonB


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.misc
Dave O
 
Posts: n/a
Default Using an IF statement on time based data

Excel treats dates as integer numbers, and times as fractional parts of
a day. For instance, my system time is 12/2/2005 4:04:25 PM Eastern
U.S. Excel's equivalent of this timestamp is 38688.6697337963. Try
this yourself by entering =NOW(), then change that cell's format to a
number with a few decimal places.

So your .46875 may be correct if you multiply it be 24 to convert the
fractional portion of a day into hours: I get 11.25, or 11 hours 15
minutes.

How are your start times and end times entered?

  #7   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Using an IF statement on time based data

Or just compare the sum with 8 hours:

=if(((d12-c12)+(f12-e12)+(h12-g12))=time(8,0,0),time(8,0,0),
(d12-c12)+(f12-e12)+(h12-g12))

or equivalently:


DonB wrote:

I guess that I am not explaining the problem very well. There are six
columns of data representing the beginning and ending times for the morning,
afternoon, and evening time frames. I have no problem in calculating the
total time worked. However, when I apply an IF statement against the total
to determine if overtime has been worked, the result is .46875 every time.
My equation is
=if(((d12-c12)+(f12-e12)+(h12-g12))=8,8,(d12-c12)+(f12-e12)+(h12-g12)). I
have tried different formattings without success.
--
DonB

"Dave Peterson" wrote:

=MIN(A1,TIME(8,0,0))

would be one way (with the time worked in A1)

DonB wrote:

I have a worksheet of payroll time data by date that i want to identify
overtime amounts in excess of 8 hours. I can't seem to write an IF statement
that correctly answers the question "If 8 hours or more, enter 8 hours, if
less then the the calculated time. It seems to be a formatting problem of
moving from time formats to number formats. HELP.
Thanks
--
DonB


--

Dave Peterson


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Using an IF statement on time based data

or equivalently...

=if(((d12-c12)+(f12-e12)+(h12-g12))=8/24,8/24,(d12-c12)+(f12-e12)+(h12-g12))

But

=min(time(8,0,0),((d12-c12)+(f12-e12)+(h12-g12)))
or
=min(8/24,((d12-c12)+(f12-e12)+(h12-g12)))

would seem reasonable.


DonB wrote:

I guess that I am not explaining the problem very well. There are six
columns of data representing the beginning and ending times for the morning,
afternoon, and evening time frames. I have no problem in calculating the
total time worked. However, when I apply an IF statement against the total
to determine if overtime has been worked, the result is .46875 every time.
My equation is
=if(((d12-c12)+(f12-e12)+(h12-g12))=8,8,(d12-c12)+(f12-e12)+(h12-g12)). I
have tried different formattings without success.
--
DonB

"Dave Peterson" wrote:

=MIN(A1,TIME(8,0,0))

would be one way (with the time worked in A1)

DonB wrote:

I have a worksheet of payroll time data by date that i want to identify
overtime amounts in excess of 8 hours. I can't seem to write an IF statement
that correctly answers the question "If 8 hours or more, enter 8 hours, if
less then the the calculated time. It seems to be a formatting problem of
moving from time formats to number formats. HELP.
Thanks
--
DonB


--

Dave Peterson


--

Dave Peterson
  #9   Report Post  
Posted to microsoft.public.excel.misc
Dave O
 
Posts: n/a
Default Using an IF statement on time based data

DonB-
Now that I think on it a little longer, your original formula appears
to have a logic flaw in it. Your formula says
=if(((d12-c12)+(f12-e12)+(h12-g12))=8,8
.... which would award someone with 8 hours' work if they worked
anything less than 8.

  #10   Report Post  
Posted to microsoft.public.excel.misc
DonB
 
Posts: n/a
Default Using an IF statement on time based data

I think that portion of the formula answers the question as to whether
someone has worked at least 8 hours and responds with 8 if that is true,
otherwise it will return the total hours actually worked which would be less
that 8.

I still think my problem has something to do with using the number 8 tho I
did try 8:00 which didn't help matters any.

Thanks for the help tho.
--
DonB


"Dave O" wrote:

DonB-
Now that I think on it a little longer, your original formula appears
to have a logic flaw in it. Your formula says
=if(((d12-c12)+(f12-e12)+(h12-g12))=8,8
.... which would award someone with 8 hours' work if they worked
anything less than 8.




  #11   Report Post  
Posted to microsoft.public.excel.misc
DonB
 
Posts: n/a
Default Using an IF statement on time based data

My appologies. I went back and tried the suggestion and it does work.
--
DonB


"Dave Peterson" wrote:

or equivalently...

=if(((d12-c12)+(f12-e12)+(h12-g12))=8/24,8/24,(d12-c12)+(f12-e12)+(h12-g12))

But

=min(time(8,0,0),((d12-c12)+(f12-e12)+(h12-g12)))
or
=min(8/24,((d12-c12)+(f12-e12)+(h12-g12)))

would seem reasonable.


DonB wrote:

I guess that I am not explaining the problem very well. There are six
columns of data representing the beginning and ending times for the morning,
afternoon, and evening time frames. I have no problem in calculating the
total time worked. However, when I apply an IF statement against the total
to determine if overtime has been worked, the result is .46875 every time.
My equation is
=if(((d12-c12)+(f12-e12)+(h12-g12))=8,8,(d12-c12)+(f12-e12)+(h12-g12)). I
have tried different formattings without success.
--
DonB

"Dave Peterson" wrote:

=MIN(A1,TIME(8,0,0))

would be one way (with the time worked in A1)

DonB wrote:

I have a worksheet of payroll time data by date that i want to identify
overtime amounts in excess of 8 hours. I can't seem to write an IF statement
that correctly answers the question "If 8 hours or more, enter 8 hours, if
less then the the calculated time. It seems to be a formatting problem of
moving from time formats to number formats. HELP.
Thanks
--
DonB

--

Dave Peterson


--

Dave Peterson

  #12   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Using an IF statement on time based data

Times and dates can be confusing--especially when you're typing...

Sometimes people mean 8 when they write 8 hours. Other times 8 hours means 8/24
(or 8:00).

You may want to read Chip Pearson's notes on date/times.
http://cpearson.com/excel/datetime.htm

There is a lot of other nice stuff on that site, too.

DonB wrote:

My appologies. I went back and tried the suggestion and it does work.
--
DonB

"Dave Peterson" wrote:

or equivalently...

=if(((d12-c12)+(f12-e12)+(h12-g12))=8/24,8/24,(d12-c12)+(f12-e12)+(h12-g12))

But

=min(time(8,0,0),((d12-c12)+(f12-e12)+(h12-g12)))
or
=min(8/24,((d12-c12)+(f12-e12)+(h12-g12)))

would seem reasonable.


DonB wrote:

I guess that I am not explaining the problem very well. There are six
columns of data representing the beginning and ending times for the morning,
afternoon, and evening time frames. I have no problem in calculating the
total time worked. However, when I apply an IF statement against the total
to determine if overtime has been worked, the result is .46875 every time.
My equation is
=if(((d12-c12)+(f12-e12)+(h12-g12))=8,8,(d12-c12)+(f12-e12)+(h12-g12)). I
have tried different formattings without success.
--
DonB

"Dave Peterson" wrote:

=MIN(A1,TIME(8,0,0))

would be one way (with the time worked in A1)

DonB wrote:

I have a worksheet of payroll time data by date that i want to identify
overtime amounts in excess of 8 hours. I can't seem to write an IF statement
that correctly answers the question "If 8 hours or more, enter 8 hours, if
less then the the calculated time. It seems to be a formatting problem of
moving from time formats to number formats. HELP.
Thanks
--
DonB

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a chart based on a 2 dim data range dynamical in 1 d Beertje Charts and Charting in Excel 1 October 25th 05 11:54 AM
Create Charts based on data in Table MAttenborough Charts and Charting in Excel 1 September 12th 05 12:00 AM
Help PLEASE! Not sure what answer is: Match? Index? Other? baz Excel Worksheet Functions 7 September 3rd 05 03:47 PM
Sharing data across worksheets within a workbook based on identifi deedle93 Excel Discussion (Misc queries) 2 August 18th 05 04:26 AM
populating sheets based on data from parent sheets seve Excel Discussion (Misc queries) 2 January 15th 05 09:22 PM


All times are GMT +1. The time now is 06:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"