Excel - How can I count the number of characters on a cell?
Asked By EddieDial80
21-May-07 03:26 AM
I have several hundreds of line items that need to be entered to a web
application that restricts the length of each line to 40 characters. Is there
a way to count the number of characters on a cell so I can automate the
review process for each cell of my spreadsheet with one formula or function
that indicates for each cell the number of characters (with spaces) that it
contains?
I appreciate very much any input
Roger Govier replied...
Hi Eddie
Try
=LEN(A1) to give you the number of characters in a cell
If you want to automatically trim the length of your entries, then in
another column use
=LEFT(A1,MIN(40,LEN(A1)))
and copy down
--
Regards
Roger Govier
CL replied...
Most cool, Roger......most cool.
Vaya con Dios,
Chuck, CABGx3
RagDyeR replied...
OK, I give up!
What's the advantage over plain 'ol:
=Left(a1,40)
--
Regards,
RD
-----------------------------------------------------------------------------------------------
Please keep all correspondence within the Group, so all may benefit !
-----------------------------------------------------------------------------------------------
Most cool, Roger......most cool.
Vaya con Dios,
Chuck, CABGx3
CL replied...
I dunno if it's an advantage or not, but one difference is...
if A1= 1.234567, the formula =LEFT(A1,MIN(4,LEN(A1))) returns 1.234567
while the formula =Left(A1,4) returns 1.23
But for most cases, there don't seem to be much difference.....
Vaya con Dios,
Chuck, CABGx3
RagDyeR replied...
That doesn't happen in my book Chuck!<g>
--
Regards,
RD
-----------------------------------------------------------------------------------------------
Please keep all correspondence within the Group, so all may benefit !
-----------------------------------------------------------------------------------------------
I dunno if it's an advantage or not, but one difference is...
if A1= 1.234567, the formula =LEFT(A1,MIN(4,LEN(A1))) returns 1.234567
while the formula =Left(A1,4) returns 1.23
But for most cases, there don't seem to be much difference.....
Vaya con Dios,
Chuck, CABGx3
CL replied...
Did you notice I changed the 40 to 4 for my examples...........
Vaya con Dios,
Chuck, CABGx3
David Biddulph replied...
Yes, and =LEFT(A1,MIN(4,LEN(A1))) returns 1.23, not 1.234567, hence RD's
comment.
If you are getting 1.234567 from that formula, what does =MIN(4,LEN(A1))
return?
--
David Biddulph
CL replied...
Ah-so.........mine mistake...........it must be all these women that keep
coming in here bugging me for "favors"........it just keeps distracting my
concentration...or maybe that was a dream I was having......<G>
Anyway, good catch guys........
Vaya con Dios,
Chuck, CABGx3
Roger Govier replied...
Hi Rick
Put it down to a senior moment!!!
For some stupid reason, I was thinking that left(a1,40) was going to pad
the value with extra spaces.
Guess I managed to fool Chuck for a few moments (he must have been
sharing that moment with me)<vbg>
Apologies to all
=LEFT(A1,40) wins the day.
--
Regards
Roger Govier
Mohammad Ibrahim replied...
You are required to be a member to post replies. After logging in or becoming a member, you will be redirected back to this page.
Trim, Replace? Excel = UPPER(TRIM(LEFT(A2, MIN(FIND({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "("}, A2&"0123456789("))-1))) With function. TIA Excel Miscellaneous Discussions SUBSTITUTE (1) ISERROR (1) VLOOKUP (1) UPPER (1) FIND (1) LEFT (1) TRIM (1) MIN (1) try = substitute(current_function, "'", "") Try this mess out = LEFT(A1, FIND("'", A1)-1) & RIGHT(A1, LEN(A1)-FIND("'", A1)) only gets the apostophe this handles errors as well in needed = IF ISERROR(LEFT(A1, FIND("'", A1)-1) & RIGHT(A1, LEN(A1)-FIND("'", A1))), A1, LEFT(A1, FIND("'", A1)-1) & RIGHT(A1, LEN(A1)-FIND("'", A1
please help me. thanks advance. raju Excel Worksheet Discussions Excel (1) SUBSTITUTE (1) LOOKUP (1) LEFT (1) MIN (1) VBA (1) LEN (1) ROW (1) Hi Raju One way. . In B1 = LEFT(A1, MIN(SEARCH({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, A1&"0123456789"))-1) In C1 = SUBSTITUTE(A1, B1, ) - - Jacob (MVP - Excel) Give these formulas a try. . . B1: = LEFT(A1, LEN(A1)-LEN(C1)) C1: = LOOKUP(9E+307, - -RIGHT(A1, ROW($1:$99))) Note: When you put the
small function Excel = SMALL(- -LEFT(I18:I30, 3), 1) how do I get this function to ignore empty cells in Programming Discussions Microsoft Excel (1) INDIRECT (1) ISNUMBER (1) ISERROR (1) INDEX (1) MATCH (1) LEFT (1) CODE (1) ATishoo, I would use a column of helper formulas: extract the leading numbers using this array formula in J18 = LEFT(I18, MIN(IF(CODE(MID(I18, ROW(INDIRECT("A1:A LEN(I18))), 1))> 57, ROW(INDIRECT("A1:A"&LEN(I18)))))-1)*1 copied to J30, then use this array formula to get the minimum: = MIN(IF(ISERROR(J18:J30), "", J18:J30)) HTH, Bernie MS Excel MVP This array-entered* * formula should get you the smallest value in your range. . . = SMALL(IF(ISNUMBER(- -LEFT(I18:I30, 3)), - -LEFT(I18:I30, 3), ""), 1) * *commit this formula using Ctrl+Shift+Enter
Can you help me correct this formula. = IF(New_Table!D2 = TRIM(SUBSTITUTE(A1, MID(A1, MIN(FIND({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, A1&"0123456789")), SUM(LEN(A1)-LEN(SUBSTITUTE(A1, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, "")))), ""))"LT", "Part Time or Temp Student", IF(New_Table!D2 = "DLT" = TRIM(SUBSTITUTE(A1, MID(A1, MIN(FIND({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, A1&"0123456789")), SUM(LEN(A1)-LEN(SUBSTITUTE(A1, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, "")))), "")), "Part-Time or column. Excel Miscellaneous Discussions Microsoft Excel (1) SUBSTITUTE (1) ISNUMBER (1) COUNTIF (1) FIND (1) LEFT (1) TRIM (1) MID (1) Never a bad idea to show us samples of the retrieve leading letter characters using this less complicated function call inside your IF function calls. . . LEFT(A1, MIN(FIND({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, A1&"0123456789
with values like '11 - 8' & '8 - 5' = 3DIF(ISERROR(SEARCH("*-*", D3)), 0, IF(AND(VALUE(LEFT(D3, SEARCH("-", D3)-1))> 12, VALUE(RIGHT(D3, LEN(D3)- SEARCH("-", D3)))> 12), "X-Hour", IF(12-VALUE(LEFT(D3, SEARCH("-", D3)-1)) +VALUE(RIGHT(D3, LEN(D3)-SEARCH("-", D3)))-1<12, 12- VALUE LEFT(D3, SEARCH("-", D3)-1))+VALUE(RIGHT(D3, LEN(D3)- SEARCH("-", D3)))-IF(12-VALUE(LEFT(D3, SEARCH("-", D3)-1)) +VALUE(RIGHT(D3, LEN(D3)-SEARCH("-", D3)))> 4, 1, 0), 0- VALUE(LEFT(D3, SEARCH("-", D3)-1))+VALUE(RIGHT