Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default Shift Result from Start Time Formula

I am looking for a formula that will return "1st", "2nd" or "3rd" depending
on the start time of a shift. I am almost there but since there is no Else I
am having a hard time programming it with just And and If functions.

e.g. 7:25 returns 1st
15:42 returns 2nd
23:45 returns 3rd.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Shift Result from Start Time Formula

The FALSE part of an IF function acts as the "else" in a programmer's If
statement. If you would tell us the range cut-offs, I'm sure someone here
would show you the formula to use.

--
Rick (MVP - Excel)


"Dan" wrote in message
...
I am looking for a formula that will return "1st", "2nd" or "3rd" depending
on the start time of a shift. I am almost there but since there is no
Else I
am having a hard time programming it with just And and If functions.

e.g. 7:25 returns 1st
15:42 returns 2nd
23:45 returns 3rd.

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Shift Result from Start Time Formula

With time in Col A the below formula will return the smallest

=SMALL(A:A,1)
'format it to time

=SMALL(A:A,2)
will return the 2nd smallest

If this post helps click Yes
---------------
Jacob Skaria


"Dan" wrote:

I am looking for a formula that will return "1st", "2nd" or "3rd" depending
on the start time of a shift. I am almost there but since there is no Else I
am having a hard time programming it with just And and If functions.

e.g. 7:25 returns 1st
15:42 returns 2nd
23:45 returns 3rd.

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Shift Result from Start Time Formula

you could create your own UDF - User Defined Function.
Maybe something like this:

Function GetShiftName(dtime As Date) As String
Select Case dtime
Case Is <= TimeValue("05:00:00")
GetShiftName = "1st"
Case Is <= TimeValue("12:00:00")
GetShiftName = "2nd"
Case Is <= TimeValue("17:00")
GetShiftName = "pm"
Case Is <= TimeValue("24:00")
GetShiftName = "night"
Case Else
GetShiftName = "u/s"
End Select
End Function



"Dan" wrote in message
...
I am looking for a formula that will return "1st", "2nd" or "3rd"
depending
on the start time of a shift. I am almost there but since there is no
Else I
am having a hard time programming it with just And and If functions.

e.g. 7:25 returns 1st
15:42 returns 2nd
23:45 returns 3rd.

Thanks


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
Formula to find Stop Time from Start Time and Total Minutes Jonathan Bickett Excel Worksheet Functions 5 March 7th 07 05:22 PM
template or formula for start time -finish time -total hours ple cc New Users to Excel 1 March 27th 06 06:06 PM
Formula for agenda to create start/stop with projected time of ev Dot Setting up and Configuration of Excel 0 March 9th 06 02:39 PM
How can I delete the end of line (result of shift-enter) Tom Ogilvy Excel Programming 0 October 1st 03 02:26 PM
How can I delete the end of line (result of shift-enter) Jake Marx[_3_] Excel Programming 2 September 30th 03 08:31 PM


All times are GMT +1. The time now is 03:56 AM.

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

About Us

"It's about Microsoft Excel"