Sign in to follow this  
Followers 0
MariaAux

Nested IF Logic

10 posts in this topic

I'm Web publishing a Database of children's games. There are 4 fields;

Preparation (sometimes empty)

How_to_Play (Always filled)

Variations (sometimes empty)

Notes (sometimes empty)

I am trying to create a nested IF function that only displays the field if it has some text in it. Just displaying one big blob of text listing field after field is obviously easy, but I want to add a header above each field if the field I included. I am getting stuck because the 1st, 3rd and 4th field are all variables. This is as far as I've got;

If (Preparation=0;"";"PREPARATION"&¶&How_to_Play)

Up until here is fine, but now adding the IF function if Variations or Notes are also empty by including/excluding them or their headers is getting me a little stuck. Any help would be HUGELY appreciated.

Thanks so much in advance,

Share this post


Link to post
Share on other sites

If (not isempty ( Preparation); "Preparation¶" & Preparation & ¶¶; "") & If (not isempty (How_to_Play); "How to Play¶" & How_to_Play; "") &

etc.

Share this post


Link to post
Share on other sites

hi bcooney,

I guess you mean the "&" and not the "and" operator :)

otherwise it would evaluate to 0 or 1.

Share this post


Link to post
Share on other sites

My gosh, yes! Need another coffee after yesterday. I've corrected my original post.

Share this post


Link to post
Share on other sites

probably the right brain kicking in :)

Share this post


Link to post
Share on other sites

A few small points - 1) if you use two ¶ together, you must wrap them in quotes as "¶¶" so the above calc will throw a syntax error and 2) it is not necessary to list a default result when using If() or Case() (blank is assumed) so you can drop the "" results:

If ( not IsEmpty ( Preparation ) ; "Preparation¶" & Preparation & "¶¶" )

&

If ( not IsEmpty ( How_to_Play) ; "How To Play¶" & How_to_Play & "¶¶" )

&

If ( not IsEmpty ( Variations ) ; "Variations¶" & Variations & "¶¶" )

&

If ( not IsEmpty ( Notes ) ; "Notes¶" & Notes )

Share this post


Link to post
Share on other sites

You guys are Geniuses! Laretta, your formula was fantastically simple to follow... and worked like a Charm. I don't know if I could really convey my absolute gratitude - You made my day! Have a wonderful day and thank you thank you again!

Share this post


Link to post
Share on other sites

LaRetta, you're so much more thorough than I am. I need to step it up.

Share this post


Link to post
Share on other sites

Hmmm . . . I've always learned from both of you!

RW

Share this post


Link to post
Share on other sites

And so do I, Rick. An error in one post does not a failure make. If so, I would be lower than the ground that dirt sits on. :yep:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • Baffled by calculation error
      By kathrynfw
      I am trying to create a field that will generate a list of phrases according to a criteria. It is based on input from a questionnaire, and designed to pull up the phrase whenever the answer to the corresponding field was higher than a one. Even though I set all the questions to two or three, the only one that is working here is the first one. In the merge field, it should list all of the phrases in quotes, but it only gives me "functional math." Can anyone see what is going on here? I am self-taught and really a novice on the calculation side of things.
      Thanks so much.
       
      If (Functional math deficits >=1; "functional math”,If (Functional reading deficits >=1; "functional reading”,If (Functional written language deficits >=1; "functional written language”,If (Impaired Theory of Mind >= 1; "theory of mind”,If (Difficulty reading social cues >=1; "social skills”,If (Difficulty sitting  attending >= 1; "learning behaviors”,If (Lacks functional living skills >= 1; "functional living skills”,If (Lacks functional play skills >= 1; "play skills”,If (Lacks independent leisure skills >= 1; "independent leisure”,If (Is over 14 lacking vocational skills >= 1; "vocational skills”,If (Student has challenges with expressive language >= 1; "expressive language”,If (Student has significant delays in receptive language >= 1; "receptive language”,If (Gross motor deficits >= 1; "gross motor skills”,If (Fine motor deficits >= 1; "fine motor skills”,If (Need for schedule >= 7; "use of visual schedule”,If (Need for work systems >=7; "using work systems and task strips for independent routines”))))))))))))))))
       
      I am not getting any errors when I save the calculation parameters (Probably not the right lingo...)
       
    • Add an "and" to a list
      By rick altman
      I have a field that receives a bunch of first names from a portal, thanks to the List function. The result might look like this:
       
      Alice, Bill, Chuck
       
      However, I need for the list to read:
       
      Alice, Bill, and Chuck
       
       
      I need to find the last comma in the text and add an "and" to it. I have been messing around with the Position function stuffed inside of a Substitute function, but I can't get it right. Can someone help?
       
      FMPA14
       
       
      Rick A.
      Pleasanton CA
    • Conditional Summing
      By Gurratheboy
      Hi Guys, I'm stuck to say I wonder if it has with brain power to do...
       
      Table "Pencils" fields:
      ----------------------------------------
      State                                                                                                      Text | Has one of two values: "Activated" or "Deactivated"
      Brand                                                                                                     Text |Can be one out of many brands......
      Pricetag                                                                                                  Numerical |the price of each pencil
      Sum_Pricetags_samebranded_and_activated pencils                           Calculation |?????
       
       
      This is what I can't figure out for the last calculation field in the table "Pencils", How do I make a calculation out of the following:
      In the calculation I want the Pencils from the same brand and with the same state "Activated" have their pricetags summed up and only if the two conditions are met.
       
      Example:
      2 pencils are of same brand and they are both in the state "Activated". The one pencil have a pricetag of 18£ and the second one have a pricetag of 10£
      Because they are of same brand and both have the same state, I want their price to sum up, 18+10=28£ 
       
       
       It does not matter what the field say if the conditions are not met for other records, the field then can stay blank.
       
      Cheers
    • IF Script skipping steps
      By eddiedredge
      Hi All, 
       
      I'm struggling with a script and count see what I'm doing wrong.
       
      The frustration is its a simple script. For some reason the script will not action the second option. If red it will run red script if blue it will run blue script, but if green it moves down to the blue if and runs the blue script. I'm so confused.  The script is just a trigger to run another script all three of which are the same just with different layouts. Any advice appreciated. 
       

       
       
       
       
    • Multiple IF Tests
      By puma55
      im trying to get my solution to generate pricing off of three separate fields and I'm stuck.
       
      ex.    If ( Package = "top 120" and Number of TVs = "1" and DVR = "no" ; "30" ; "" ,  If ( Package = "top 120" and Number of TVs = "2" and DVR = "no" ; "37" ; "" ))
       
      that returns "too many parameters"
       
       
      ex.  If ( Package = "top 120" and Number of TVs = "1" and DVR = "no" ; "30" ; "") ,  If ( Package = "top 120" and Number of TVs = "2" and DVR = "no" ; "37" ; "" )
       
      that returns "an operator is expected"
       
       
      if done properly there would be 24 different "prices" generated from the combination of three fields.  3 different packages, # or tv's 1-4 and with or without a DVR. i know im close but cant seem to make it work, any help would be great
       
      thank you
      dave