IF Statements in Shapesheet Cells

Started by music_al, April 29, 2008, 08:31:09 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

music_al

I have 2 Shape Data items: Device Name and Device Type

I want to set some rules in the Shapesheet, so lets use this example...

Fruit Types ="Banana;Apple;Orange"  *I am typing this in the FORMAT box
Fruit Colors =IF(Prop.Row_8="Banana","Yellow",IF(Prop.Row_8="Apple","Green",IF(Prop.Row_8="Orange","Orange","")))  *Will this formula work and if so, where do I type it ? I have tried it in the FORMAT and VALUE cell, but neither works.

Any ideas ?


Many thanks

Allan

Visio Guy

Hi music_al,

To compare strings, you'd do IF(StrSame(Prop.Fruit.Value,"Apple") Direct comparison of text in the ShapeSheet doesn't work.

Another structure that works is to use indices. That way you can change the format string without messing with your code:

Prop.Fruit.Format = "Banana;Apple;Orange"
Prop.Fruit.Value = "Apple"  (for example)

User.fruitIndex = LOOKUP(Prop.Fruit.Value, Prop.Fruit.Format)  ( = 0, 1, 2  or -1 )
User.color = IF(User.fruitIndex = 0, ...=1, ...=2)
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010