IF/OR statement not working

Started by Michelle, May 04, 2009, 03:25:20 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Michelle

I have this statement in my Text Fields format cell:

=OR(IF(STRSAME(Pages[Page-1]!Sheet.8!Prop.ConduitLeftRight1,("On Left Wall")),IF(STRSAME(Pages[Page-1]!Sheet.8!Prop.ConduitLeftRight1,("On Right Wall")),"@","0 u")

And I can't figure why it's not working correctly.  Visio seems to want more after the last parenthases, but if I try another parenthases, I still get an error.  Hmmm.

What I want is that if the user chooses either On Left Wall or On Right Wall in the Shape Data, then that text will show in a box on page two.  If the user chooses one of many dimension choices, the dimension will show in the box. 

Any help is appreciated!
Michelle

vojo

("on the wall") should be "on the wall...same for other

Michelle

I'm sorry, I don't follow...  ???

Are you saying take off the parenthases around my "On Left Wall" and "On Right Wall" ?

I tried this:
=(OR(IF(STRSAME(Pages[Page-1]!Excel.8!Prop.ConduitLeftRight1,"On Left Wall"),STRSAME(Pages[Page-1]!Excel.8!Prop.ConduitLeftRight1,"On Right Wall"),"@"),"0 u"))

And the statement was accepted (no error message), but it doesn't work right.  If the user chooses the dimensions, they show up correctly in the box, but the text "On Right Wall" or "On Left Wall" don't...

Sorry, I'm still confused :-[

wapperdude

#3
Part of the problem is the syntax of your structure.  Remember that an IF statement wants IF(logical test, true result, false result).  Your structure is:
IF(strsame test1, if(strsame test2, "@"), "0 u").  The OR statement isn't really doing anything, and the 2nd IF doesn't have a false result.  As for the "@", have not tried that.

One solution would be:
IF(strsame test1,"true result1", if(strsame test2, "true result2", "false result both IF cases")).  OR statement not needed.

So what  happens, 1st strsame test passes, it executes the true result1.  If the 1st strsame fails, it executes 2nd IF and checks test2.  If test2 passes, then executes true result2.  If test2 fails, it executes the failed results.  The failed results executes if neither true tests passed.

That ought to work.  Attached drawing shows structure Visio-ally
Wapperdude
Visio 2019 Pro

Michelle

Thanks Wapperdude.

It's beginning to make more sense, although I have to admit I don't think I would have come up with the syntax you explained on my own.

The first time I tried it, when I chose either right or left wall, the text in the box chnaged, but not to read right or left wall, it just changed whatever the previous dimensional choice was to a decimal reading.  In my case, it went from 1 ft. 4 in. to 1 ft. 4.0000in.

I figured the problem must be my "@", so I changed that to "On Left Wall" and "On Right Wall" where appropriate, but that made things worse!  Right now, for example, if the right wall selection is chosen, the text in the box goes all funky:  O1900 Ri190012A Monall  yikes!

What am I doing wrong now?

Augh!  I'm so close to the end of this project I can taste it!
Thank you so much for your patience :-[

Michelle

#5
I think I got it.  I went back and looked at the explanation of Format Pictures on the Visio area of the MSDN. 

I actually wound up trying something that I thought there was no way would work, but it did! :o

I now have this: =IF(STRSAME(Pages[Page-1]!Excel.8!Prop.ConduitLeftRight1,"On Left Wall")," \O\n \L\e\f\t\ \W\a\l\l",IF(STRSAME(Pages[Page-1]!Excel.8!Prop.ConduitLeftRight1,"On Right Wall")," \O\n \R\i\g\h\t\ \W\a\l\l","0 u"))

All the slashes make the text show up the way I need.  Thanks again for all the help and patience, I guess I can stop kicking myself now, and finish this darn project!

Michelle

Visio Guy

No kicking! Visio-skill is a black art at times.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010