Is there any better way to set out multiple IF statements?
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 10 of 10

Thread: Is there any better way to set out multiple IF statements?

  1. #1
    Board Regular
    Join Date
    Apr 2002
    Location
    Australia
    Posts
    52
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    Cos i am using a formula with about 4 If statements in it, and i am finding it hard to read and it is getting quite confusing. :|
    Thanx

  2. #2
    Board Regular
    Join Date
    Feb 2002
    Location
    Calgary, Alberta Canada
    Posts
    3,335
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default



    Yes



    Check Help on boolean, Vlookup, HLookup, Lookup, Choose, etc.



  3. #3
    Board Regular
    Join Date
    Mar 2002
    Posts
    363
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try using the OR function
    It's never too late to learn something new.

    Ricky

  4. #4
    Board Regular
    Join Date
    Feb 2002
    Location
    Huntington Beach, CA USA
    Posts
    327
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    "If" statements can get very confusing and
    hard to read, that's why the "real guys"
    suggest using "select case" you may want to
    it.

    James

  5. #5
    Board Regular
    Join Date
    Mar 2002
    Posts
    363
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Select Case is only available in VBA but not in the Excel application.
    It's never too late to learn something new.

    Ricky

  6. #6
    Board Regular
    Join Date
    Apr 2002
    Location
    Australia
    Posts
    52
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    So how do you write a formula using the VBA instead of the formula box?

  7. #7
    MrExcel MVP Jay Petrulis's Avatar
    Join Date
    Mar 2002
    Location
    Chicago, IL USA
    Posts
    2,040
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-04-13 22:33, KnAsTa wrote:
    So how do you write a formula using the VBA instead of the formula box?
    Hi,

    Please show us your formula (or describe in detail what you'd like to do).

    Thanks,
    Jay

  8. #8
    Board Regular
    Join Date
    Feb 2002
    Location
    Ahmedabad Gujarat
    Posts
    303
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    if you have multiple conditions and you want to use if statements. the best way is to use.

    Select Case testexpression
    [Case expressionlist-n
    [statements-n]] ...
    [Case Else
    [elsestatements]]

    End Select


    you can see the how select statement can be used by taking on line help also


    this is the best way to go.

    ni****h desai
    http://www.pexcel.com

  9. #9
    Board Regular
    Join Date
    Apr 2002
    Location
    Australia
    Posts
    52
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    =IF(ISERROR(LOOKUP(A5,week1.xls!$A$1:$A$10,0)),IF(VLOOKUP(A5,week1.xls!$A$1:$D$10,3,0)>VLOOKUP(A5,week1.xls!$A$1:$D$10,4,0),3,0),IF(ISNA(LOOKUP(A5,week1.xls!$A$1:$D$10,4)>VLOOKUP(A5,week1.xls!$A$1:$D$10,3,0)),3,0))

    Thats the formula using 3 IF statements.
    Confusing?

  10. #10
    Board Regular
    Join Date
    Feb 2002
    Location
    Ahmedabad Gujarat
    Posts
    303
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    There are people you use boolean by multiplications and additions and returns the values..

    one is i suppose from arnold site.. where he has explained how to use without 'IF'

    i have have downloaded his sample file where he has given the example ..

    his address
    http://geocities.com/aaronblood

    ni****h desai
    http://www.pexcel.com

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com