Valid if only contains numbers

LEN([BARCODE])=LEN(TEXT(NUMBER([Barcode])))

Can I get a second opinion on if the above valid if formula means that my [Barcode] column can’t contain a non number character? It seems to but I haven’t done thorough testing.

Solved Solved
0 2 1,283
1 ACCEPTED SOLUTION

Steve
Platinum 4
Platinum 4

TEXT() will render the Number value for display, which will include thousands separators if the number has enough digits. Does the original value have thousands separators? Perhaps use CONCATENATE() instead to avoid display formatting.

Converting a textual numeric value to a numeric value then back to a textual value will strip leading zeros, which could change the length of the converted value. You’ll need to handle that.

([BARCODE] = RIGHT(("0000000000" & NUMBER([BARCODE])), LEN([BARCODE])))

View solution in original post

2 REPLIES 2

Steve
Platinum 4
Platinum 4

TEXT() will render the Number value for display, which will include thousands separators if the number has enough digits. Does the original value have thousands separators? Perhaps use CONCATENATE() instead to avoid display formatting.

Converting a textual numeric value to a numeric value then back to a textual value will strip leading zeros, which could change the length of the converted value. You’ll need to handle that.

([BARCODE] = RIGHT(("0000000000" & NUMBER([BARCODE])), LEN([BARCODE])))

You are extra right too since the barcode can start with 0s!

Top Labels in this Space