Two Plus Two Older Archives

Two Plus Two Older Archives (http://archives2.twoplustwo.com/index.php)
-   Other Other Topics (http://archives2.twoplustwo.com/forumdisplay.php?f=32)
-   -   another Excel question for you brilliant OOTiots! (http://archives2.twoplustwo.com/showthread.php?t=240792)

Rhone 04-27-2005 12:21 PM

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.

tech 04-27-2005 12:27 PM

Re: another Excel question for you brilliant OOTiots!
 
=IF(HOUR(A1)<6,1,IF(HOUR(A1)<12,2,IF(HOUR(A1 )<18,3,4)))

hogua 04-27-2005 12:35 PM

Re: another Excel question for you brilliant OOTiots!
 
You beat me to it!

guller 04-27-2005 12:36 PM

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?

Rhone 04-27-2005 12:42 PM

Thanks! (n/m)
 
THANKS, EVERYONE!

swolfe 04-27-2005 01:27 PM

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

dabluebery 04-27-2005 03:53 PM

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

swolfe 04-27-2005 03:57 PM

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.


All times are GMT -4. The time now is 08:15 PM.

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