The print system allows 12 characters for an equipment label. Put that limit in D1 and put Desk lamp XL and Desk lamp XXL in A2:A3.

Separate the length from the decision

In B2 use =LEN(A2). In C2 use =IF(B2>$D$1,"Shorten","Fits") and fill both down. Expect 12 and Fits for XL, 13 and Shorten for XXL.

Two label strings sit against a 12-character limit.

Illustrated boundary check. Both spaces count.

Check what Fits means on a blank row

A blank has length 0 and passes the maximum. If a description is required, add a separate blank or space-only check. Try one exact-length label in the receiving tool too, especially if its limits are measured in bytes or it accepts characters outside this ASCII example.

A blank label passes a maximum length check and needs its own required-field check.

Illustrated empty-input check.

Related Microsoft Excel reference