+ Reply to Thread
Results 1 to 10 of 10

Struggling to complete "IF" statement

  1. #1
    Registered User
    Join Date
    08-10-2007
    Posts
    15

    Struggling to complete "IF" statement

    Hi,

    This is my first posting, so please be gentle. I'm not a beginner, but also not an expert. I want to create a traffic light indicator based on the following, and am able to get all the elements to work with the exception of the (0,1). Could someone out there please help !!

    The trafficlight is based on 2 cells

    A1 0 0 1 1 20 20
    A2 0 1 1 2 19 15

    if row A1=0 and row A2=0 then print "W"
    if row A1=0 and row A2>0 then print "G"
    if after that
    if row A1=row A2 = or > 0 then print "G"
    if row A1/row A2 < 0.8 (80%) then print "R"
    if row A1/row A2 <1 (but greater than 0.8) then print "A"

    I hope that it is clear.There's a lot of sport on this weekend and I don't want to spend the weekend re-hacking the spreadsheet about because I cannot workout a lousy "IF" statement.

    Many thanks

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Does this work?

    Please Login or Register  to view this content.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    08-10-2007
    Posts
    15
    Thanks for your quick reply,but doesn'twanttogo past the first ",". I willcontinue toplay with it.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    I think the problem is in this part of the formula: IF(OR(A1=A2,A1>0)... this is probably almost always going to be true.

    what exactly did you mean by this?:
    if row A1=row A2 = or > 0 then print "G"

  5. #5
    Registered User
    Join Date
    08-10-2007
    Posts
    15
    if row A1 is equal to or greater than row A2

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Then?:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    08-10-2007
    Posts
    15
    Still will not go past the first comma

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by RWJ
    Still will not go past the first comma
    Not exactly sure what you mean.

    If A1<>0, then is should result in "G", "R" or "A" depending on what's in A2


    see attached. Change values in A1 and A2 and see B1 change result...
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    08-10-2007
    Posts
    15
    Brilliant. Working great. Can now watch the cricket all weekend

    Many thanks

  10. #10
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by RWJ
    Brilliant. Working great. Can now watch the cricket all weekend

    Many thanks

    Enjoy your games!

+ 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