## Differs if input is a number or letter

Started by LunJep, October 24, 2022, 03:19:11 PM

0 Members and 1 Guest are viewing this topic.

#### LunJep

Hope there is someone who can help.
Struggling with a formula.
Need to define if a letter or a number is entered in the "R1" field. If a letter from A-D is entered, it says "this is a letter" and if a number 0-3 is entered, it says "it's a number"
Only formulas as macos are not allowed

#### Surrogate

Quote from: LunJep on October 24, 2022, 03:19:11 PM
Struggling with a formula.
Need to define if a letter or a number is entered in the "R1" field. If a letter from A-D is entered, it says "this is a letter" and if a number 0-3 is entered, it says "it's a number"
We need more details: what shape from which template/stencil do you need change ?

#### wapperdude

What do you mean by "R1" field?  Is this a shape data entry, a User defined entry, or some other?

Are the values 0 - 3, and A - D the only possible entry values, or are there other, non-acceptable values.

The basic formula structure would be something like =IF( strsame(prop.R1, OR(A,B,C,D)), "Is letter", IF(strsame(prop.R1, OR(0,1,2,3))," Is Number", "Invalid entry")).

Where Prop.R1, or however the user makes an entry, is first compared to the letters.  If there's a match, it provides the letter notification, if not, it checks the numerical values and either prints the number notification if successful, or the invalid notification indicating there was no match at all.
Visio 2019 Pro

#### LunJep

"R1" is an shape data entry. An field where I put an letter or number - depending on the drawing revision. And have an "Status field" where I would like it to automatic select an status text, depending on the input in R1.

If the R1 = A,B,C or D then the text should be "issued for comments", and if R1 = 0,1,2,3 the text should be "issued for construction"

#### LunJep

I did try out the custom formular : =IF( strsame(prop.R1, OR(A,B,C,D)), "Is letter", IF(strsame(prop.R1, OR(0,1,2,3))," Is Number", "Invalid entry"))
- but it comes up with "error in formula" (- dont see why ??)

#### wapperdude

Not at my computer... but as my suggested formula wasn't intended to be literal, I believe the error is the quotes around the text string.  The Visio expected format is either triple quotes, as """Your txt""", or using the asci character chr(34) such that you would have...wait for it...  & chr(34) & " Your txt" & chr(34) .

Alternatively, upload a simple file as example so that we're all working on common base.
Visio 2019 Pro

#### LunJep

Sorry.

Having problems verifying what is entered Have tried with a simple formula as this:
As =IF( strsame(prop.R1!, =(A,B,C,D)), "Is letter", "Invalid entry")
No luck & same error description

#### wapperdude

#7
That last syntax is totally wrong.

Here's working syntax example.  It uses two cascade IF statements.  First IF checks for letters, 2nd IF checks for numbers.  IF letters are correct, then you get 1st message.  If numbers, then you get 2nd message.  If neither, then the last msg.  Note, the letters are case sensitive.

The letters requjire using string same for comparison.

=IF(OR(STRSAME(Prop.R1,"A"),STRSAME(Prop.R1,"B")),"Good Ltrs",IF(OR(Prop.R1=1,Prop.R1=2),"Good Nums","Not so good"))
Visio 2019 Pro

#### LunJep

But still get the error messages ' Error in formula'
I'm copying and paste the line:
=IF(OR(STRSAME(Prop.R1,"A"),STRSAME(Prop.R1,"B")),"Good Ltrs",IF(OR(Prop.R1=1,Prop.R1=2),"Good Nums","Not so good"))
in to the custom formula.

I'm trying to figure out what are wrong - the field name = R1 (OK)
And would like an more simple formula, like if R1 = A then saying "A"
and trying with; =IF(STRSAME(Prop.R1,"A"),"Ltrs",IF(Prop.R1,"1","Nums","Not so good")) - but same visio do not  understand the formula

#### wapperdude

#9
Did you read what I wrote?

QuoteAnd would like an more simple formula, like if R1 = A then saying "A"
. This will not work for text (string) comparison.  It is only valid for numerical comparison.  Look at my example formula, you will see both...one syntax for alpha compares, and 2nd for numeric compares.

That formula was tested in a shape and works, no errors.  Perhaps you should upload simple file.  At least, perhaps a screenshot so we can see what's going on.
Visio 2019 Pro

#### LunJep

Attached screenshot and the drawing

#### LunJep

I would appriciate, if wapperdude or anyone have the time to look at the problem I'm having.

Information: Rev. = R1, R2, R3 etc. and the 'Description' should be the text if letter or number