Issue with "IF" in calculation field

Tagged: 

This topic contains 3 replies, has 2 voices, and was last updated by  Brendan 8 months, 2 weeks ago.

  • Author
    Posts
  • January 7, 2019 at 2:32 AM #33286

    Victor Warner
    Participant

    I have:

    1. a (text) field called “Title”. This contains entries such as “Mr”, “Ms”, “Miss” or “Mrs”.
    2. another calculation field called “Gender”, which contains the following:

    IF([Title] = “Mr”, “his”, “her”).

    The result type is set to text.

    Whether I type in “Mr” or “Ms” or “Miss” or “Mrs” the only result that the calculation produces is “his”.

    Am I doing something wrong?

    January 7, 2019 at 3:15 AM #33293

    Brendan
    Keymaster

    The IF(condition; then; else) function only works with a numeric condition.

    You’ll need to use IFEQUAL(A; B; C; D) instead.

    IFEQUAL(A;B;C;D) will return C if A and B are equal. If A and B are not equal, returns D. A and B must be text.

    • This reply was modified 8 months, 2 weeks ago by  Brendan.
    January 7, 2019 at 9:44 AM #33301

    Victor Warner
    Participant

    Brendan,

    Thank you for the explanation.

    Sorry to nit-pick, but the IFEQUAL function is not in the manual (online or pdf). I suggest for new users it might help to have a line of explanation in the manual that the IF function is not for use where the user wishes to make a text comparison, but they should use IFEQUAL instead.

    January 7, 2019 at 2:04 PM #33307

    Brendan
    Keymaster

    Oops. Yes you’re right. I’ve just added information to the manual for the IFEQUAL() function.

You must be logged in to reply to this topic.