Two Plus Two Older Archives  

Go Back   Two Plus Two Older Archives > 2+2 Communities > Other Other Topics
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-27-2005, 12:21 PM
Rhone Rhone is offline
Senior Member
 
Join Date: Jul 2004
Posts: 177
Default another Excel question for you brilliant OOTiots!

I have a column A, formatted for time, like:

13:45
9:38

etc.

Next to it I would like each cell in column B to take its corresponding cell from A, and return a number 1 through 4, depending on which 6 hour period the time from column A falls in.

so,

00:00 to 5:59 --> 1
6:00 to 11:59 --> 2
12:00 to 17:59 --> 3
18:00 to 23:59 --> 4

Any idea how to code column B?

thanks guys,

Rhone.
Reply With Quote
  #2  
Old 04-27-2005, 12:27 PM
tech tech is offline
Member
 
Join Date: Apr 2004
Posts: 74
Default Re: another Excel question for you brilliant OOTiots!

=IF(HOUR(A1)<6,1,IF(HOUR(A1)<12,2,IF(HOUR(A1 )<18,3,4)))
Reply With Quote
  #3  
Old 04-27-2005, 12:35 PM
hogua hogua is offline
Senior Member
 
Join Date: Dec 2004
Posts: 279
Default Re: another Excel question for you brilliant OOTiots!

You beat me to it!
Reply With Quote
  #4  
Old 04-27-2005, 12:36 PM
guller guller is offline
Senior Member
 
Join Date: Dec 2004
Location: Traverse City, MI
Posts: 133
Default Re: another Excel question for you brilliant OOTiots!

I don't know how to begin to code that, but you could sort them out pretty quickly into groups using the custom autofilter button. Then copy and paste a 1-4 in column b. This would yield the same result. How many workbooks do you need to do this to?
Reply With Quote
  #5  
Old 04-27-2005, 12:42 PM
Rhone Rhone is offline
Senior Member
 
Join Date: Jul 2004
Posts: 177
Default Thanks! (n/m)

THANKS, EVERYONE!
Reply With Quote
  #6  
Old 04-27-2005, 01:27 PM
swolfe swolfe is offline
Senior Member
 
Join Date: Nov 2004
Posts: 632
Default Re: another Excel question for you brilliant OOTiots!

a less cludgy solution:

=INT(HOUR(A1)/6)+1

you'll probably have to manually format the column as an integer
Reply With Quote
  #7  
Old 04-27-2005, 03:53 PM
dabluebery dabluebery is offline
Junior Member
 
Join Date: Dec 2003
Posts: 13
Default Re: another Excel question for you brilliant OOTiots!

This is fine, the IF statement code that's written. Just keep in mind that if your conditions were just a little more complicated, you should abandon an IF statement and use VLOOKUP. There's a great Excel forum you can use for complicated advice, PM me for that or for other Excel help.

Rob
Reply With Quote
  #8  
Old 04-27-2005, 03:57 PM
swolfe swolfe is offline
Senior Member
 
Join Date: Nov 2004
Posts: 632
Default Re: another Excel question for you brilliant OOTiots!

i don't get why you'd use a bunch of nested IF's when it's obviously just a math problem.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:12 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.