MariaAux Posted November 25, 2011 Posted November 25, 2011 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,
bcooney Posted November 25, 2011 Posted November 25, 2011 If (not isempty ( Preparation); "Preparation¶" & Preparation & ¶¶; "") & If (not isempty (How_to_Play); "How to Play¶" & How_to_Play; "") & etc.
andries Posted November 25, 2011 Posted November 25, 2011 hi bcooney, I guess you mean the "&" and not the "and" operator otherwise it would evaluate to 0 or 1.
bcooney Posted November 25, 2011 Posted November 25, 2011 My gosh, yes! Need another coffee after yesterday. I've corrected my original post.
LaRetta Posted November 25, 2011 Posted November 25, 2011 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 )
MariaAux Posted November 25, 2011 Author Posted November 25, 2011 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!
bcooney Posted November 25, 2011 Posted November 25, 2011 LaRetta, you're so much more thorough than I am. I need to step it up.
Rick Whitelaw Posted November 26, 2011 Posted November 26, 2011 Hmmm . . . I've always learned from both of you! RW
LaRetta Posted November 28, 2011 Posted November 28, 2011 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:
Recommended Posts
This topic is 4997 days old. Please don't post here. Open a new topic instead.
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 accountSign in
Already have an account? Sign in here.
Sign In Now