Hi,
I have a name field where the user needs to Input First Name + Last Initial. eg(John B) I need to validate the field to make sure they entered the last initial and not just the first name.(john)
Solved! Go to Solution.
@AleksiAlkio wrote:
Do you mean LEN() instead if COUNT()?
Yes I did!
AND(
LEN(INDEX(SPLIT([Name], " "), 1)) > 1,
LEN(INDEX(SPLIT([Name], " "), 2)) = 1
)
This might be difficult if a person has two first names - such as Mary Lou or Jim Bob.
However, if you are willing to ignore those, then you can use a validation expression like this:
AND(
COUNT(INDEX(SPLIT([Name], " "), 1)) > 1,
COUNT(INDEX(SPLIT([Name], " "), 2)) = 1
)
This is splitting the input by the space. Then checks if the First Name portion, position 1, has more than a single character. And that position 2 has only a single character.
You can use the messaging to explain what input is expected should the validation fail.
@WillowMobileSys Do you mean LEN() instead if COUNT()?
@AleksiAlkio wrote:
Do you mean LEN() instead if COUNT()?
Yes I did!
AND(
LEN(INDEX(SPLIT([Name], " "), 1)) > 1,
LEN(INDEX(SPLIT([Name], " "), 2)) = 1
)
It happens easily ๐
Thank you! it worked great!
Would having two fields (first_name and last_name_initial) and making them required work?
Just a thought.
@TeeSee1 wrote:
Would having two fields (first_name and last_name_initial) and making them required work?
Yes that is an option as well. These would then be combined. So you would have 3 columns/fields instead of just the 1.
Personally, since this seems to just be an identifier of the person, I would keep just the single column. If I were recording full names, I would implement it as you suggested and have the 3rd column to combine.
@WillowMobileSys wrote:
This might be difficult if a person has two first names - such as Mary Lou or Jim Bob.
As you so aptly pointed out.. A two fields solution solves this.
I am curious though how this particular name format is helpful.
User | Count |
---|---|
34 | |
31 | |
30 | |
18 | |
17 |