Author Topic: Differs if input is a number or letter  (Read 595 times)

0 Members and 1 Guest are viewing this topic.

LunJep

  • Jr. Member
  • **
  • Posts: 11
Differs if input is a number or letter
« on: October 24, 2022, 10:19:11 AM »
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

  • Hero Member
  • *****
  • Posts: 1636
    • ShapeSheet™ Knowledge Base
Re: Differs if input is a number or letter
« Reply #1 on: October 24, 2022, 10:42:35 AM »
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

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4477
  • Ideas Visio-lized into solutions
Re: Differs if input is a number or letter
« Reply #2 on: October 24, 2022, 10:56:26 AM »
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

  • Jr. Member
  • **
  • Posts: 11
Re: Differs if input is a number or letter
« Reply #3 on: October 25, 2022, 09:44:48 AM »
Sorry for the bad description.
"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

  • Jr. Member
  • **
  • Posts: 11
Re: Differs if input is a number or letter
« Reply #4 on: October 25, 2022, 09:49:16 AM »
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

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4477
  • Ideas Visio-lized into solutions
Re: Differs if input is a number or letter
« Reply #5 on: October 25, 2022, 10:16:54 AM »
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

  • Jr. Member
  • **
  • Posts: 11
Re: Differs if input is a number or letter
« Reply #6 on: October 25, 2022, 11:30:10 AM »
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

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4477
  • Ideas Visio-lized into solutions
Re: Differs if input is a number or letter
« Reply #7 on: October 25, 2022, 10:19:27 PM »
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"))
« Last Edit: October 25, 2022, 10:21:27 PM by wapperdude »
Visio 2019 Pro

LunJep

  • Jr. Member
  • **
  • Posts: 11
Re: Differs if input is a number or letter
« Reply #8 on: October 26, 2022, 10:20:46 AM »
Thanks for reply/feedback. :-)

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

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4477
  • Ideas Visio-lized into solutions
Re: Differs if input is a number or letter
« Reply #9 on: October 26, 2022, 02:47:35 PM »
Did you read what I wrote?

Quote
And 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. 
« Last Edit: October 26, 2022, 02:52:53 PM by wapperdude »
Visio 2019 Pro

LunJep

  • Jr. Member
  • **
  • Posts: 11
Re: Differs if input is a number or letter
« Reply #10 on: October 27, 2022, 09:36:26 AM »
Attached screenshot and the drawing

LunJep

  • Jr. Member
  • **
  • Posts: 11
Re: Differs if input is a number or letter
« Reply #11 on: October 27, 2022, 09:53:05 AM »
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