none
Custom field function error RRS feed

  • Question

  • I can not for the life of my find the error in this function. Any help is much apperciated

     Switch(AND(StrComp([risk_Charter Type],"type1") = 0, StrComp([risk_Project Budget], "somemoney")=0), "Some Text",AND(StrComp([risk_Charter Type],"type2") = 0, StrComp([risk_Project Budget], "differentmoney") <> 0),"Different some text", StrComp([risk_Charter Type],"type3") = 0, "Text at the end")

    Thursday, June 23, 2011 7:20 PM

Answers

  • Runngun,

    I didn't ring out your whole formula but when I enter it to create a custom text field, a formula error is flagged for the first "AND" (right after the Switch). Just off the top of my head, that AND looks out of place.

    When I get an error in a formula and the error isn't obvious, I break down the formula into smaller components and put those into other custom fields. It helps to isolate each part to find out where the problem is. Try that.

    John

    • Marked as answer by Runngun Friday, June 24, 2011 12:36 PM
    Thursday, June 23, 2011 8:29 PM

All replies

  • Runngun,

    I didn't ring out your whole formula but when I enter it to create a custom text field, a formula error is flagged for the first "AND" (right after the Switch). Just off the top of my head, that AND looks out of place.

    When I get an error in a formula and the error isn't obvious, I break down the formula into smaller components and put those into other custom fields. It helps to isolate each part to find out where the problem is. Try that.

    John

    • Marked as answer by Runngun Friday, June 24, 2011 12:36 PM
    Thursday, June 23, 2011 8:29 PM
  • When i send it in, it just says there is an error and hight lights the whole thing.

    I was following excel format because thats what i was translating from, my bad i changed AND(StrComp([risk_Charter Type],"type1") = 0, StrComp([risk_Project Budget], "somemoney")=0),  to (StrComp([risk_Charter Type],"type1") = 0 AND StrComp([risk_Project Budget], "somemoney")=0) and still get an error. Ill try your second comment tomarrow. Thanks for the advice 

    Thursday, June 23, 2011 8:35 PM
  • Runngun,

    "Send it in"? What exactly does that mean?

    Does it still highlight the whole formula? If so, then something more basic is wrong with how you entered the formula. Let us know how it works when you break it down into pieces.

    John

    Friday, June 24, 2011 12:55 AM
  • I mean send it in to the compiler by saving, im sorry for the confusion. Doing it line by line did not reveal any flaws but it worked... I hate debuging sometimes. Thanks for your advice! Ill try that in the furture instead of coming back!
    Friday, June 24, 2011 12:36 PM
  • Runngun,

    You're welcome and thanks for the feedback. If I need to do something fairly simple I might use a formula but if the formula ends up being several lines in length the chance for an entry error is much greater and much more difficult to troubleshoot. I prefer to use VBA.

    John

    Friday, June 24, 2011 2:34 PM