IF Statement help

Started by jebuxx, December 11, 2014, 01:48:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jebuxx

I have 3 sheets on an entry page. Sheet 85 is a drop down to select an envelope type of approx 10 styles.
The other 2 sheet (65 & 66) will display the width and lenght of the envelope selected from the drop down.
I need help writing the IF statement and where in the shape sheet it should be entered.

wapperdude

1st, terminology point, objects on the drawing page are "shapes" not sheets...even though they're named sheets, e.g., sheet.65.  See how simple and logical that was?!?    :o   ???

Question:  do sheet.65 and sheet.66 show the same info, i.e., both show width and length?

Wapperdude
Visio 2019 Pro

wapperdude

The very basic approach, assuming that shape, sheet.85, uses Shape Data for the dropdown list, something like Prop.ES, then, use the Insert > Field approach for each of the other shapes.

Select sheet.65, go to the Menu Bar > Insert > Field and select Custom Formula.  Enter a formula something like:  =sheet.85!Prop.ES.  That's it.  Whatever size is chosen from the dropdown list, will show in the shape.  Do same for sheet.66.

Wapperdude
Visio 2019 Pro

jebuxx

OK, I will try to more clear. I have 3 shapes (sheet 85, sheet 64,sheet 66)
Shape (sheet) 85 is a drop down list of envelope types. (i.e. #10;#11;6x9;booklet;)
Shape (sheet) 64 will display the width of the selected envelope. (example- 9.5 in)
Shape (sheet 65) will display the height of the same selected envelope (example- 4.125 in)
As mentioned I have Shape (sheet 85) as a drop down in the shape data working
thanx again



jebuxx

I hope this helps to make it even more clear also.
Sample IF statement (This I have tried with no success) where am I failing?

=If(EVALTEXT(SHeet.85!The Text)=#10,(EVALTEXT(Sheet.65!TheText),"9.5 inch",""))) If(EVALTEXT(SHeet.85!The Text)=#10,(EVALTEXT(Sheet.66!TheText),"4.125 inch",""))))))

Thanx

wapperdude

Couple of points:
  1.  The EVALTEXT is the wrong function, s/b STRSAME
  2.  The IF statement construct isn't catenated correctly.
  3.  I'd simplify the IF statement by making two, one for the length, and one for the width.  Makes reading and editing easier.
  4.  Put the IF statements in 2 user defined entries, user.row_1 and user.row_2.  (Rename if desired, e.g., user.row_1 might be user.EWid)

So, the IF structure would be something like:  =IF(STRSAME(Prop.ES,"Letter",1),"8.5",IF(STRSAME(Prop.ES,"Legal",1),"8.5","6")).  This evaluates 3 cases:  "Letter", "Legal", and neither of those two.  Add cases as needed.
   a.  This would be IF statement for envelop width.  Identical formula for length (or height), but with different values obviously.
   b.  The very last  entry does not need an IF function, because it is evaluated when the previous cases are false.  It is the only remaining value possible.

All of the above go into the shape, Sheet.85.  I have renamed the Shape Data row from prop.row_1 to prop.ES.

Now, select one of the other shapes, e.g., sheet.65.  In V2007, go to the menu bar, Insert>Fields and in the custom formula enter =sheet.85!user.row_1.  For the sheet.66 shape, do the same, except now =sheet.85!user.row_2.. Note sure where it is on ribbon based versions. 

Note:  you can keep your IF statements compact by omitting the "units".  Just change the Field formula to be =Sheet.85!User.row_1 & " in."
If you want a more detailed presentation, try:  ="Width:" & CHAR(10) & Sheet.1!User.row_1 & " in.".  This gives 2 rows.  CHAR(10) is linefeed.

I'm attaching a Visio file that does the above.  In the example, your sheet.85 becomes my sheet.1.  Note also, I modified the sheet.1 to change the dblclick event in the Events section near the end of the shapesheet to have the formula docmd(1312).  That way, when you double click the shape, the shape data window pops up.

Also, I slaved the sheet.1 width & length to mimic the size of the envelope selected.  See the width and length entries.

Wapperdude
Visio 2019 Pro

jebuxx

That worked great!!! Thank you very much for the help. I may have more questions in the future you Visio King