+ Reply to Thread
Results 1 to 10 of 10

Formula error

  1. #1
    Registered User
    Join Date
    02-02-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    62

    Formula error

    What is the error here ?

    How do I fix this ?

    2016-03-02_0835.png

  2. #2
    Valued Forum Contributor
    Join Date
    05-14-2012
    Location
    Unknown
    MS-Off Ver
    Unseen
    Posts
    429

    Re: Formula error

    Looks as though it might be the wrong type of double quote ... ” instead of "

  3. #3
    Registered User
    Join Date
    02-02-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    62

    Re: Formula error

    Yes..you are right ...there was quote issue. ..its fixed now.

    I want to add these conditions in expression..

    if(B1>264 AND <283 , "BUY")

    if(B1<264, "STOP")

    if(B1>283, "WATCH")


    What is the correct syntax to do this ? Can we add multiple conditions on a cell ?

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Formula error

    Maybe this...
    =IF(AND(B1>264,B1<283),"BUY",if(B1<264,"STOP","WATCH"))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Valued Forum Contributor
    Join Date
    05-14-2012
    Location
    Unknown
    MS-Off Ver
    Unseen
    Posts
    429

    Re: Formula error

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    02-02-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    62

    Re: Formula error

    thats a scary looking syntax...

    there is a if inside a if.
    "and" looks as a function

    I wish if there was a simpler syntax ..

    anyway...this seems working.

    is it possible to see a green color text for buy ? that would be very nice looking in my spreadsheet.

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Formula error

    It,s not really that bad. Just break it down and it's really fairly straight forward...
    =IF(AND(B1>264,B1<283),"BUY",if(B1<264,"STOP","WATCH"))

    It starts with the IF statement
    =IF(this-is-true, Do-This, Else-Do-That)
    The cool thing about that is that Do-This and Do-That can both also be IF statements, which can also contain IF statements...
    =IF(its a boy,IF(he is blonde,IF(he is under 21,IF(he speaks english,IF(...............these can be "nested" many many deep, and this was all JUST for the Do-This part. The Do That part can look the same, if you wanted

    when you test for 2 things, they either BOTH need to match, or ONLY one needs to match. For that we use AND or OR...
    AND(B1>264,B1<283)
    In this case, we are testing to see that B1 > 264 AND B1 < 283

    So, if B1>264 AND B1<283, return "BUY",
    if B1 is outside that range we need a 2nd test...
    IF(B1<264,"STOP","WATCH")
    put them all together,,,
    =IF(AND(B1>264,B1<283),"BUY",if(B1<264,"STOP","WATCH"))
    Make sense?

    OK on to the coloring
    We can do that with Conditional Formatting (probably again, something new to you?) It causes cells to change their format (color etc) based on what is shown in the cell
    1. highlight the range you want to apply the conditional formatting to
    2. on the home tab, styles, select CF
    3. select new rule, select use formula
    4. enter =A1="Buy"

    Change A1 as needed

  8. #8
    Forum Contributor
    Join Date
    02-07-2013
    Location
    Karachi, Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    290

    Re: Formula error

    Hi,
    Or this if B1 not less than zero:

    =LOOKUP(B1,{0,264,284},{"stop","buy","watch"})

    Blessing

  9. #9
    Registered User
    Join Date
    02-02-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    62

    Re: Formula error

    I'm using online google spreadsheet. How do you do that colouring part there with this ?

  10. #10
    Registered User
    Join Date
    02-02-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    62

    Re: Formula error

    B1 > 264 AND B1 < 283 = > AND(B1>264,B1<283) // this is odd looking syntax ... this looks like AND is a function !

    but anyway ...this works...thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 03-12-2014, 12:42 PM
  2. [SOLVED] Inputbox error message. Formula you typed contains an error.
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-09-2013, 02:25 PM
  3. Excel 2007 : Formula error:bring up an #VALUE! Error.
    By burner007 in forum Excel General
    Replies: 3
    Last Post: 06-20-2011, 06:10 AM
  4. Formula Error-Error Message
    By Paige in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-25-2006, 04:15 PM
  5. Replies: 1
    Last Post: 07-20-2006, 03:05 PM
  6. Replies: 4
    Last Post: 03-24-2006, 07:20 AM
  7. [SOLVED] Error values:DIV/0! error in SumProduct formula with no division
    By Jerry W. Lewis in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 07:05 PM
  8. Formula error with Mac resulting in '#NAME' error
    By Linking to specific cells in pivot table in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-01-2005, 03:05 AM

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