+ Reply to Thread
Results 1 to 11 of 11

Simple IF/Or function

  1. #1
    Forum Contributor
    Join Date
    10-26-2011
    Location
    Ottawa, ON Canada
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    128

    Simple IF/Or function

    I thought this would be straight forward.

    Column A is the date. Column B = Column A but in DDDD format. I want column C to give me a value based off column B.

    If column B = "Saturday" or "Sunday" then column C is 8. If any other day, then 9.
    My If/Or formula works if column B is just text, but if it's in DDDD format it won't work..

    Sample file attached.

    Workbook3.xlsx

    Thanks for your help.
    Rob

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Simple IF/Or function

    Try

    =IF(OR(TEXT(B2,"dddd")="Sunday",TEXT(B2;"dddd")="Saturday"),8,9)
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Simple IF/Or function

    or
    =MIN(FLOOR(WEEKDAY(A1,2),6)+8,9)
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Forum Contributor
    Join Date
    10-26-2011
    Location
    Ottawa, ON Canada
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    128

    Re: Simple IF/Or function

    Thanks both.

    Fotis. Yours worked after I fixed the semi-colon to a comma after the 2nd B2...

    Thanks for your method Martin. Something new for me to add to my Excel knowledge..

  5. #5
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Simple IF/Or function

    You are welcome

    We use semi colons as separators in Greece. So i have always to change the semi colons of my formulas to comma.

    Unfortunately sometimes, i forget some of these!

  6. #6
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Simple IF/Or function

    Another one, but shorter.......

    =9-(WEEKDAY(A2,2)>5)

  7. #7
    Forum Contributor
    Join Date
    10-26-2011
    Location
    Ottawa, ON Canada
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    128

    Re: Simple IF/Or function

    Thanks Mama! That works too.. but I have no idea how?!

  8. #8
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Simple IF/Or function

    You're Welcome!

  9. #9
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Simple IF/Or function

    i think i can explain how Mama's formula works:

    the Weekday Function will return a a value of 1-7, with 6 and 7 being the weekend,
    so if it returns a value larger than 5 (TRUE = 1) the formula reads 9-1 = 8 (Sat or Sun)
    but if it returns a value <=5 (FALSE = 0) the formula reads 9-0 = 9 (Mon-Fri)

    hope that helps !
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  10. #10
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Simple IF/Or function

    ive just realised my solution is the wrong way around"
    so
    =MIN(ABS(FLOOR(WEEKDAY(A1,2),6)-7)+7,9)
    but tm's
    =9-(WEEKDAY(A2,2)>5) is better

  11. #11
    Forum Contributor
    Join Date
    10-26-2011
    Location
    Ottawa, ON Canada
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    128

    Re: Simple IF/Or function

    Thanks again all. I like the simplicity of Mama's, but I also like that =IF(OR(TEXT(B2,"dddd")="Sunday",TEXT(B2;"dddd")="Saturday"),8,9) has a visual of the actual values (8 or 9) as I'd like to change these values every once in a while...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1