Text string length to return set value.

Ian Betteridge

Active Member
Joined
Mar 25, 2006
Messages
472
Good Morning All,
I'm after the following....
If the text string in column A is
less than 5 return 1
less than 9 return 2
less than 13 return 3
less than 17 return 4
& equal to or greater than 17 return 5
Example below.
Book1
ABCD
1Machine TagLevel
21234-LAY-PKG-W014
31234-LAY-PKG-W024
41234-MIN2
51234-LAY-PKG-W014
61234-MIN-MAN3
71234-LAY-PKG-W02-RFW2225
81234-MIN-PKW3
91234-MIN-PKW-W114
101234-MIN2
111234-MIN-PKW-B144
121234-MIN2
1312341
141234-MIN-PKW3
151234-MIN-MAN-M12-CVP1215
Sheet1


Regards Ian
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
how about

=MATCH(LEN(A2),{0,5,9,13,17})
 
Last edited:
Upvote 0
You're welcome Ian,

please check that you have the edited version of the formula, the original had the wrong values in the array.
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top