Excel condition with OR operator -


i learning ms excel formula making. if cell of column a has text sat or sun within respective column b should weekly off following not working.

=if(or(search("sun",a:a),search("sat",a:a)),"weeklyoff") 

=if(or(search("sun",a1),search("sat",a1)),"weeklyoff","") 

normally place in b1 , copy down. if did series of errors. problem when either search fails located text searching for, generates error. avoid this, need wrap search in error catcher iferror , set return 0 if there error.

=if(or(iferror(search("sun",a1),0),iferror(search("sat",a1),0)),"weeklyoff","") 

now technically speaking search going tell start location of looking within string. if have "xxxxsat2" search "sat" going tell 4. luckily logical part of if statement seems take positive integer true. above formula work is. have changed following:

=if(or(isnumber(search("sun",a1)),isnumber(search("sat",a1))),"weeklyoff","") 

alternatively if column excel date cells formatted display day of week, use following:

=if(or(weekday(a1)=1,weekday(a1)=7),"weeklyoff","") 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -