If formula with time

HockeyDiablo

Board Regular
Joined
Apr 1, 2016
Messages
182
Not too good working with time in excel. But what I would like to do is write a formula in an adjacent cell:

If the time is;

06:00-10:00 = AM1
10:00-12:00 = AM2
12:00-14:00 = MID1
14:00-16:00 = MID 2
16:00-18:00 = PM1
18:00-22:00 = PM2
 
You can try something along the lines of

[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[TD="align: center"]E[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]Time[/TD]
[TD="align: center"]Value[/TD]
[TD="align: center"][/TD]
[TD="align: center"]Time[/TD]
[TD="align: center"]Value[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]0:01[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]7:00[/TD]
[TD="align: center"]AM1[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]6:00[/TD]
[TD="align: center"]AM1[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]10:00[/TD]
[TD="align: center"]AM2[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]12:00[/TD]
[TD="align: center"]MID1[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]14:00[/TD]
[TD="align: center"]MID2[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"]16:00[/TD]
[TD="align: center"]PM1[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD="align: center"]18:00[/TD]
[TD="align: center"]PM2[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD="align: center"]22:00[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
</tbody>[/TABLE]

E2 =LOOKUP(D2,$A$2:$A$9,$B$2:$B$9)
 
Last edited:
Upvote 0
You can try something along the lines of

[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[TD="align: center"]E[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]Time[/TD]
[TD="align: center"]Value[/TD]
[TD="align: center"][/TD]
[TD="align: center"]Time[/TD]
[TD="align: center"]Value[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]0:01[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]7:00[/TD]
[TD="align: center"]AM1[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]6:00[/TD]
[TD="align: center"]AM1[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]10:00[/TD]
[TD="align: center"]AM2[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]12:00[/TD]
[TD="align: center"]MID1[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]14:00[/TD]
[TD="align: center"]MID2[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"]16:00[/TD]
[TD="align: center"]PM1[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD="align: center"]18:00[/TD]
[TD="align: center"]PM2[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD="align: center"]22:00[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
</tbody>[/TABLE]

E2 =LOOKUP(D2,$A$2:$A$9,$B$2:$B$9)


way easier than: =IF((AND(K2>=0.25,K2<=1.416667)),"AM1",IF((AND(K2>4.16667,K2<=0.5)),"AM2",IF((AND(K2>0.5,K2<=0.58333)),"MID1",IF((AND(K2>0.58333,K2<=0.666667)),"MID2",IF((AND(K2>0.666667,K2<=0.75)),"PM1",IF((AND(K2>0.75,K2<=0.916667)),"PM2","AH"))))))

ty
 
Upvote 0

Forum statistics

Threads
1,226,850
Messages
6,193,350
Members
453,790
Latest member
yassinosnoo1

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