Dum IF statement question!

jackmccarthy

New Member
Joined
Feb 1, 2013
Messages
32
Hello
I have a calculated column in powerpivot that has numbers 0 thur 24 called "hour of day" That represent the hours of the day.
I need to say if the hour is 0 to 8 "GRAVE" 8 TO 16 "DAY" AND 16 TO 24 "SWING". Can someone please give me the =if statement for this?

This is what I have. Not working
=IF([hour of day]<8,"GRAVE",IF([hour of day]<16,"DAY","SWING"))THANKS </pre>
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
What about...
=SWITCH(TRUE(), [hour of day]<=8, "GRAVE", [hour of day]>8 && [hour of day]<=16, "DAY", "SWING")

Or just replace the argument for your second IF statment with this one: [hour of day]>8 && [hour of day]<=16

You might have to play with the <=, <, >, and >= depending on where you need to group the 8 and 16.
 
Last edited:
Upvote 0
=IF([hour of day]<8,"GRAVE",IF([hour of day]>8 && [hour of day]<=16,"DAY","SWING"))

This or the SWITCH() should give the same result...aside from the variations in the <, <= etc. that you need to adjust depending on where you want the 8 and 16.
 
Upvote 0
It needs to be this:
=IF([hour of day]<=8,"GRAVE",IF([hour of day]>8 && [hour of day]<=16,"DAY","SWING"))

This will make the 8's part of GRAVE and the 16's part of DAY.
 
Upvote 0
=IF([hour of day]<8,"GRAVE",IF([hour of day]>8 && [hour of day]<=16,"DAY","SWING") ok now I am returning swing in all rows of column
 
Upvote 0

Forum statistics

Threads
1,217,071
Messages
6,134,417
Members
449,872
Latest member
Big Jake

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top