+ Reply to Thread
Results 1 to 7 of 7

Is there better way to write this if statement

  1. #1
    Registered User
    Join Date
    06-25-2009
    Location
    Canada, Victoria
    MS-Off Ver
    Excel 2003
    Posts
    10

    Is there better way to write this if statement

    Hi,

    Just wondering if there is a better way to write this?

    =IF(Weekend!P7="Beauchamp, Suzanne",Weekend!R7,IF(Weekend!P8="Beauchamp, Suzanne",Weekend!R8,IF(Weekend!P9="Beauchamp, Suzanne",Weekend!R9,IF(Weekend!P10="Beauchamp, Suzanne",Weekend!R10,IF(Weekend!P11="Beauchamp, Suzanne",Weekend!R11,IF(Weekend!P12="Beauchamp, Suzanne",Weekend!R12,IF(Weekend!P14="Beauchamp, Suzanne",Weekend!R14,IF(Weekend!P15="Beauchamp, Suzanne",Weekend!R15,0))))))))

    regards,

  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: Is there better way to write this if statement

    Hi

    One other way is using INDEX & MATCH functions.

    =INDEX($R$7:$R$14;MATCH("Beauchamp, Suzanne";$P$7:$P$14;0))

    Hope to helps you.
    Attached Files Attached Files
    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 Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,443

    Re: Is there better way to write this if statement

    Also perhaps
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    06-25-2009
    Location
    Canada, Victoria
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Is there better way to write this if statement

    Thanks for your help. It worked great. I have another one for you.

    =IF(Q7="Beauchamp, Suzanne",(Availability!$G$8),IF(Q7="Gamble, Katherine",(Availability!$G$11),IF(Q7="Jacek, Ian",(Availability!$G$15),IF(Q7="Maxwell, Ashley ",(Availability!$G$18),IF(Q7="Mead, Chloe",(Availability!$G$21),IF(Q7="Michie, Carolyn",(Availability!$G$24),IF(Q7="Park, Melody",(Availability!$G$27),IF(Q7="Philip, Troy",(Availability!$G$30),""))))))))&IF(Q7="Rodriguez, Anastasia",(Availability!$G$33),IF(Q7="Russell, Kade",(Availability!$G$36),IF(Q7="Scinocca, Michael",(Availability!$G$39),IF(Q7="Su, Raymond",(Availability!$G$42),IF(Q7="Tavares, Andrew",(Availability!$G$45),IF(Q7="Turner, Sydney",(Availability!$G$48),IF(Q7="Vaal-Henke, Adam",(Availability!$G$51),IF(Q7="Watts, Alannah",(Availability!$G$54),""))))))))&IF(Q7="Woo, Janice",(Availability!$G$57),IF(Q7="Young, Maura",(Availability!$G$60),""))

    Just wondering again if there was a better way to write this.

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Is there better way to write this if statement

    Perhaps this might help.

    1/. Make a list of the required names and use this for the validation of Q7

    2/. Add the required row numbers to return in the adjacent cells

    Then
    Please Login or Register  to view this content.
    where S2:S19 is the names list and T2:T19 the row numbers.

    Note your row numbers are almost in sequence, are the first two correct?
    Should they perhaps be 9, 11?
    If so you don't need the column of row numbers, this will do
    Please Login or Register  to view this content.
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  6. #6
    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: Is there better way to write this if statement

    Hi again.

    There is, also in this case, a way, using INDEX&MATCH,again.

    Hope to helps you.
    Attached Files Attached Files

  7. #7
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Is there better way to write this if statement

    As I said earlier it can be done without using a "Row"/"Cell Ref" column.
    See this example using one dynamic named list, for the validation in Q7, add to or subract from the list in Column T as required.

    Select from the drop-down in Q7

    Do the names appear anywhere in Sheet "Availability"?
    Attached Files Attached Files

+ 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