IF Statement with twelve conditions for time conditioning

Jescanilla

New Member
Joined
Aug 17, 2021
Messages
14
Office Version
  1. 365
Platform
  1. Windows
Hi everyone as the tittle says im trying to use twelve if statement to categorize different times but the formula its getting huge, im trying to do it separately and then unit it, but if i overlap a condition i start geting errors.
Its there a easy way to do it?
this is the table of conditions that im trying to do.

1681568219505.png


i couldnt copy the entire table cuz it was to wide but here its an example.



Horometro semanal.xlsx
BCDEFG
20:00PISOPISO
30:05PISOPISO
40:10PISOPISO
50:15PISOPISO
60:20PISOPISO
70:25PISOPISO
80:30PISOPISO
90:35PRIMERAFALSEPRIMERA
100:40PRIMERAFALSEPRIMERA
110:45PRIMERAFALSEPRIMERA
120:50PRIMERAFALSEPRIMERA
130:55PRIMERAFALSEPRIMERA
141:00FALSEFALSEFALSE
151:05FALSEFALSE
161:10FALSEFALSE
171:15FALSEFALSE
181:20FALSEFALSE
191:25FALSEFALSE
201:30FALSEFALSE
211:35FALSEFALSE
221:40FALSEFALSE
231:45FALSEFALSE
241:50FALSEFALSE
251:55FALSEFALSE
262:00FALSEFALSE
272:05FALSEFALSE
282:10FALSEFALSE
292:15FALSEFALSE
302:20FALSEFALSE
312:25FALSEFALSE
322:30FALSEFALSE
332:35FALSEFALSE
342:40FALSEFALSE
352:45FALSEFALSE
362:50FALSEFALSE
372:55FALSEFALSE
383:00FALSEFALSE
393:05FALSEFALSE
403:10FALSEFALSE
413:15FALSEFALSE
423:20FALSEFALSE
433:25FALSEFALSE
443:30:00RELEVORELEVO
453:35:00FALSERELEVO
463:40:00FALSERELEVO
473:45:00FALSERELEVO
483:50:00FALSERELEVO
493:55:00FALSERELEVO
504:00:00FALSERELEVO
514:05:00FALSERELEVO
524:10FALSERELEVO
534:15FALSERELEVO
544:20FALSERELEVO
554:25FALSERELEVO
564:30RELEVORELEVO
574:35FALSERELEVO
584:40FALSERELEVO
594:45FALSERELEVO
604:50FALSERELEVO
614:55FALSERELEVOFALSE
625:00FALSEFALSERELEVO
635:05FALSEFALSERELEVO
645:10FALSEFALSERELEVO
655:15FALSEFALSERELEVO
665:20FALSEFALSERELEVO
675:25FALSEFALSERELEVO
685:30RELEVORELEVORELEVO
695:35FALSEFALSE
705:40FALSEFALSE
715:45FALSEFALSE
725:50FALSEFALSE
735:55FALSEFALSE
746:00FALSEFALSE
756:05FALSEFALSE
766:10FALSE
776:15FALSE
786:20FALSE
796:25FALSE
806:30FALSE
816:35FALSE
826:40FALSE
836:45FALSE
846:50FALSE
856:55FALSE
867:00FALSE
877:05FALSE
887:10FALSE
897:15FALSE
907:20FALSE
917:25FALSE
927:30FALSE
937:35FALSE
947:40FALSE
957:45FALSE
967:50FALSE
977:55FALSE
988:00FALSE
998:05FALSE
1008:10FALSE
1018:15FALSE
1028:20FALSE
1038:25FALSE
1048:30FALSE
1058:35FALSE
1068:40FALSE
1078:45FALSE
1088:50FALSE
1098:55FALSE
1109:00FALSE
1119:05FALSE
Sheet2
Cell Formulas
RangeFormula
D2:D14D2=IF(AND(HOUR(B2)>=0,MINUTE(B2)>=0,HOUR(B2)<=0,MINUTE(B2)<=30),"PISO",IF(AND(HOUR(B2)>=0,MINUTE(B2)>=30,HOUR(B2)<=0,MINUTE(B2)<=59),"PRIMERA"))
F2:F43F2=IF(AND(HOUR(B2)>=0,MINUTE(B2)>=0,HOUR(B2)<=0,MINUTE(B2)<=30),"PISO",IF(AND(HOUR(B2)>=0,MINUTE(B2)>=30,HOUR(B2)<=0,MINUTE(B2)<=59),"PRIMERA"))
F44:F68F44=IF(AND(HOUR(B44)>=3,MINUTE(B44)>=30,HOUR(B44)<=5,MINUTE(B44)<=59),"RELEVO",IF(AND(HOUR(B44)>=4,MINUTE(B44)>=0,HOUR(B44)<=4,MINUTE(B44)<=29),"RELEVO"))
G61:G75G61=IF(AND(HOUR(B61)>=5,MINUTE(B61)>=0,HOUR(B61)<=5,MINUTE(B61)<=30),"RELEVO")
E9:E42E9=IF(AND(HOUR(B9)>=3,MINUTE(B9)>=30,HOUR(B9)<=5,MINUTE(B9)<=29),"RELEVO")
E43E43=IF(AND(HOUR(B43)>3,MINUTE(B43)>=30,HOUR(B43)<=5,MINUTE(B43)<=29),"RELEVO")
E44:E111E44=IF(AND(HOUR(B44)>=3,MINUTE(B44)>=30,HOUR(B44)<=5,MINUTE(B44)<=30),"RELEVO")
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
You can use vlookup if you create a table of times like this, I put this on sheet 2:
Cell Formulas
RangeFormula
A3:A49A3=A2+(1/48)


then get the correct text :
Excel Formula:
=VLOOKUP(A1,Sheet2!A$2:B$49,2,TRUE)
Do check that I have got the correct text at the correct time in the table
 
Upvote 0
Solution

Forum statistics

Threads
1,214,583
Messages
6,120,383
Members
448,955
Latest member
BatCoder

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