Count product code characters (LEN)
Shipping labels only fit a fixed number of characters, and every product code in A2:A5 is a different length — PRD-1023 is not the same width as SKU-9. Fill Code length in C2:C5 with how many characters each code contains. The dash counts.
Your solution should use cell references so it updates automatically when Test Case input values change.
Notes
LEN(text) returns the number of characters, including dashes, digits, and spaces. LEN("PRD-1023") is 8: three letters, one dash, and four digits. A hardcoded 8 fails as soon as the code in A2 changes.
Function guide
FAQ
How do I count characters in a cell?
Use =LEN(A2). It returns the number of characters stored in A2. LEN("PRD-1023") is 8.
Does LEN count the dash and spaces?
Yes. Every character counts: letters, digits, dashes, and spaces. "SKU-9" is 5. "Ana Lee" is 7 because of the space.
What if the code has extra spaces?
A trailing space adds 1 to the count. =LEN(TRIM(A2)) removes leading and trailing spaces before measuring. Characters in the middle, including the dash, stay.