November 25, 201114 yr 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,
November 25, 201114 yr If (not isempty ( Preparation); "Preparation¶" & Preparation & ¶¶; "") & If (not isempty (How_to_Play); "How to Play¶" & How_to_Play; "") & etc.
November 25, 201114 yr hi bcooney, I guess you mean the "&" and not the "and" operator otherwise it would evaluate to 0 or 1.
November 25, 201114 yr My gosh, yes! Need another coffee after yesterday. I've corrected my original post.
November 25, 201114 yr 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 )
November 25, 201114 yr Author 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!
November 28, 201114 yr 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:
Create an account or sign in to comment