IF condition (calculating slabs)

kennylal

Board Regular
Joined
Dec 10, 2008
Messages
72
Hello All,

In excel i have data as per below format

Emp ID Name CheckIn Checkout hrs/Duration SLAB
aaa 10:16 AM 7:36 PM 9:20
bbb 11:21 AM 8:37 PM 9:16

i want to calculate slab through formula.

Slab details
7-8 hrs should be in slab - A
8-9 hrs should be in slab - B
9-10 hrs should be in slab - C
10-11 hrs should be in slab - D

Thanks
Kenny
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
You could use VLOOKUP for this, using a range lookup (i.e. the fourth setting = TRUE), based on your hour column

Something like =VLOOKUP(HOUR([your time e.g. 9:20]),[slab data table],2,TRUE)

Where slab data table is your list of hours and associated slabs
7 - A
8 - B
etc...
 
Upvote 0
Try:

<b>Excel 2007</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style=";">aaa</td><td style="text-align: right;;">10:16 AM</td><td style="text-align: right;;">7:36 PM</td><td style="text-align: right;;">9:20</td><td style=";">C</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style=";">bbb</td><td style="text-align: right;;">11:21 AM</td><td style="text-align: right;;">8:37 PM</td><td style="text-align: right;;">9:16</td><td style=";">C</td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #A6AAB6;border-top:none;text-align: center;background-color: #E0E0F0;color: #161120">Sheet1</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #A6AAB6"><thead><tr style=" background-color: #E0E0F0;color: #161120"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">D1</th><td style="text-align:left">=(<font color="Blue">C1-B1</font>)</td></tr><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">E1</th><td style="text-align:left">=LOOKUP(<font color="Blue">D1*24,{7,8,9,10},{"A","B","C","D"}</font>)</td></tr></tbody></table></td></tr></table><br />
 
Upvote 0
Overlap?

Should 7 -8, 8 - 9 etc be

7 - 7:59, 8 -8:59

Also, what output for less than 7 hours or more than 11?

Consider:

=LOOKUP(HOUR(A1),{0,7,8,9,10,11},{"","A","B","C","D",""})

Does this give anything like the results you're after?
 
Upvote 0
Excel Workbook
ABCDEF
1Emp ID NameCheckInCheckouthrs/DurationSLABSLAB2
2Name110:16 AM5:36 PM07:20AA
3Name211:21 AM7:37 PM08:16BB
4Name312:26 PM9:38 PM09:12CC
5Name412:31 PM10:39 PM10:08DD
6Name510:36 AM11:40 PM13:04DD
7
8
9lookup table
1007:00A
1108:00B
1209:00C
1310:00D
Sheet2


Two alternatives:
E2 and copy down using lookup table.
F2 and copy down without the need for a lookup table.
 
Upvote 0
Thanks to Mrexcel.com. You people are Genius, thanks a lot all of you to help me out.

Thank you
Guys
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,332
Members
449,077
Latest member
jmsotelo

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