Tap Forms – Organizer Database App for Mac, iPhone, and iPad › Forums › Using Tap Forms › IF Calculations to display text from Numbers
- This topic has 6 replies, 3 voices, and was last updated 6 months ago by Mitzi Pages.
-
AuthorPosts
-
February 20, 2018 at 4:46 AM #27428
Michael DandeoParticipantI love tap forms! for what I’m using it for, it works GREAT. Now I’ve got some basic forms completed, im slowly going back and customizing and trying to find new ways to display data. But im stuck in a few areas (mainly calculations). Maybe im stuck in Excel thinking or I need to view the problem from another angle.
I am trying to build a calculation to display a text string from a number in another field. IF doesn’t seem to want to display text, am I doing this wrong?
– I have a Table field with 5 data Columns (numbers) and a 6th column to SUM all the columns together. In a number field I am trying to turn that SUM from the table field into Text such as “High, Low”. My wife is also interested in doing this for a form she is using as a grade book for private tutoring.
– This is an example of what I’m trying to do but can’t seem to it make work.
IF([FEILD]<11,”Low”)
Result Type? Text,Number? I’ve tried bothUltimately I would like to have nested IF Functions to display text for numbers ranging from 1-100. But my syntax seems to be wrong with a basic IF function and can’t figure out how to start.
Any help would be much appreciated. Ive only been using Tap Forms for a few weeks and Im still experimenting and exploring…. Thank you
February 20, 2018 at 12:39 PM #27429
BrendanKeymasterHi Michael,
I’m glad you’re loving Tap Forms!
You’re very close. What you want to do in your IF statement is to provide a value for the “else” clause.
The full syntax of the IF statement is this:
IF(condition; then; else)
So to be valid, you must provide 3 parameters. The first parameter,
condition
, must evaluate to true or false, but it must also be a numeric comparison. Thethen
parameter can be text or numeric. Theelse
parameter can also be text or numeric.So in your case, try this:
IF([Field] < 11; "Low"; "High")
So in one condition you return “Low” if the value of Field is less than 11 or High if it’s greater than or equal to 11.
If you need to compare equality of textual data, use the
IFEQUAL(A; B; C; D)
function instead. A & B must be text, but C and D can be text or numeric values. The above function says “If A and B are equal, then return C, otherwise if A and B are NOT equal, return D”.Hope that makes sense!
Brendan
February 21, 2018 at 8:39 PM #27433
Michael DandeoParticipantThat worked!! Thank you for the help, I really do appreciate it.
I think syntax is what really got me. I didn’t expect to need a space after [Field] or “else” clause. And I was assuming I would get a “False” if my formula didn’t run properly.
Again thank you. that one little piece of info solved a lot of questions for me.
February 21, 2018 at 8:57 PM #27434
BrendanKeymasterHi Michael,
The space shouldn’t be an issue. But the problem with your expression was you were passing 2 parameters into a function that requires 3 parameters. I just like to put spaces in to make them easier to read.
June 20, 2024 at 1:21 AM #50819
Mitzi PagesParticipantHello Brendan, i am having issues with IF Nesting Functions. I searched and found that it is much simpler/easier to use script. However, i do not know Script. I saw the tutorial and was having a hard time comprehending. Anyway, I hope you can help if the formula. I need Field B to show 3 results, depending on 4 conditions:
if Field A is 1, result is 2 weeks before the date in field C
if Field A is 2 or 3, result is 1 month before the date in Field C
if Field A is more than 3, result is 2 months before the date in Field C
if Field A is 0, Field B should be blankThanks so much in advance! TapForms is GREAT!
June 20, 2024 at 9:32 PM #50822
BrendanKeymasterYa, that would be easier to read and debug with a Script field. But can be done with a Calculation field:
IF(FieldA = 1; DATEADD(FieldC;0;0;-2;0;0;0;0); IF(FieldA = 2 ~ FieldA = 3; DATEADD(FieldC;0;-1;0;0;0;0;0); IF(FieldA > 3; DATEADD(FieldC;0;-2;0;0;0;0;0); "")))
I haven’t tested this, so it might not work, but that’s the general idea. The
~
character meansor
June 22, 2024 at 5:18 PM #50832
Mitzi PagesParticipantHi Brendan, thanks so much! it worked!
-
AuthorPosts
You must be logged in to reply to this topic.