Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default Finding cells of different string length.

Hi,
I have a large table of data that is used to print random codes. The data is
started as an excel file which is then changed to notepad due to the large
quantity of codes. The ink jet printer that extracts the code uses the
string length to know where it starts and finishes each code. If there is a
cell with the wrong string length the whole thing goes out of sync. How can I
search the data for cells containing the incorrect string length.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,389
Default Finding cells of different string length.

Where is the string length stored?

To find the length of a cell A1, for example, use =len(a1). Then compare
this to the string length.

Regards,
Fred.

"kingie" wrote in message
...
Hi,
I have a large table of data that is used to print random codes. The data
is
started as an excel file which is then changed to notepad due to the large
quantity of codes. The ink jet printer that extracts the code uses the
string length to know where it starts and finishes each code. If there is
a
cell with the wrong string length the whole thing goes out of sync. How
can I
search the data for cells containing the incorrect string length.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default Finding cells of different string length.

The database i used was supplied in notepad form. It had 1000000 codes in it.
Each code was 8 characters long plus a space making each string length 9.
When the job went wrong and we had several thousand codes printed
incorrectly. I checked the dat and found that 4 of the codes were 8 character
without a space. To find them i copied and pasted all the data into an excel
worksheet. This gave me approximately 14 columns with 65536 cells in each. I
then set up a calculation for each cell =(lens A1)+1000000 Then dragged it
down and across to give a result for each cell. This all took hours. Then i
did a find on the result looking for cells with a value of 1000008 This gave
me my answer but didn't tell another cell only had 5 characters in it. So we
had another mishap whem printing the data. I am sure there must be an easier
way.
Thanks for your help.
Regards
charlie

"Fred Smith" wrote:

Where is the string length stored?

To find the length of a cell A1, for example, use =len(a1). Then compare
this to the string length.

Regards,
Fred.

"kingie" wrote in message
...
Hi,
I have a large table of data that is used to print random codes. The data
is
started as an excel file which is then changed to notepad due to the large
quantity of codes. The ink jet printer that extracts the code uses the
string length to know where it starts and finishes each code. If there is
a
cell with the wrong string length the whole thing goes out of sync. How
can I
search the data for cells containing the incorrect string length.



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default Finding cells of different string length.

This will look at Row 5 down to the last used row in column A

Sub stringLength()
Const whatColumn = "A" 'Change to your needs
Dim looper As Long 'looper = 5 Starting row of data change to your needs
Dim lastToCheckRow As Long
Dim cellPointer As Variant

lastToCheckRow = Range(whatColumn & Rows.Count).End(xlUp).Row

For looper = 5 To lastToCheckRow
Set cellPointer = Worksheets("Sheet1").Cells(looper, 1)
If Len(cellPointer) < 9 Then
MsgBox cellPointer.Address
End If
Next looper
End Sub

"kingie" wrote:

The database i used was supplied in notepad form. It had 1000000 codes in it.
Each code was 8 characters long plus a space making each string length 9.
When the job went wrong and we had several thousand codes printed
incorrectly. I checked the dat and found that 4 of the codes were 8 character
without a space. To find them i copied and pasted all the data into an excel
worksheet. This gave me approximately 14 columns with 65536 cells in each. I
then set up a calculation for each cell =(lens A1)+1000000 Then dragged it
down and across to give a result for each cell. This all took hours. Then i
did a find on the result looking for cells with a value of 1000008 This gave
me my answer but didn't tell another cell only had 5 characters in it. So we
had another mishap whem printing the data. I am sure there must be an easier
way.
Thanks for your help.
Regards
charlie

"Fred Smith" wrote:

Where is the string length stored?

To find the length of a cell A1, for example, use =len(a1). Then compare
this to the string length.

Regards,
Fred.

"kingie" wrote in message
...
Hi,
I have a large table of data that is used to print random codes. The data
is
started as an excel file which is then changed to notepad due to the large
quantity of codes. The ink jet printer that extracts the code uses the
string length to know where it starts and finishes each code. If there is
a
cell with the wrong string length the whole thing goes out of sync. How
can I
search the data for cells containing the incorrect string length.



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default Finding cells of different string length.

Hi Mike,
Sorry if I sound thick but that went straight over my head, any chance you
could tell me step by step where and what to put into the worksheet?
Thanks for answering
Regards
Charlie.
"Mike" wrote:

This will look at Row 5 down to the last used row in column A

Sub stringLength()
Const whatColumn = "A" 'Change to your needs
Dim looper As Long 'looper = 5 Starting row of data change to your needs
Dim lastToCheckRow As Long
Dim cellPointer As Variant

lastToCheckRow = Range(whatColumn & Rows.Count).End(xlUp).Row

For looper = 5 To lastToCheckRow
Set cellPointer = Worksheets("Sheet1").Cells(looper, 1)
If Len(cellPointer) < 9 Then
MsgBox cellPointer.Address
End If
Next looper
End Sub

"kingie" wrote:

The database i used was supplied in notepad form. It had 1000000 codes in it.
Each code was 8 characters long plus a space making each string length 9.
When the job went wrong and we had several thousand codes printed
incorrectly. I checked the dat and found that 4 of the codes were 8 character
without a space. To find them i copied and pasted all the data into an excel
worksheet. This gave me approximately 14 columns with 65536 cells in each. I
then set up a calculation for each cell =(lens A1)+1000000 Then dragged it
down and across to give a result for each cell. This all took hours. Then i
did a find on the result looking for cells with a value of 1000008 This gave
me my answer but didn't tell another cell only had 5 characters in it. So we
had another mishap whem printing the data. I am sure there must be an easier
way.
Thanks for your help.
Regards
charlie

"Fred Smith" wrote:

Where is the string length stored?

To find the length of a cell A1, for example, use =len(a1). Then compare
this to the string length.

Regards,
Fred.

"kingie" wrote in message
...
Hi,
I have a large table of data that is used to print random codes. The data
is
started as an excel file which is then changed to notepad due to the large
quantity of codes. The ink jet printer that extracts the code uses the
string length to know where it starts and finishes each code. If there is
a
cell with the wrong string length the whole thing goes out of sync. How
can I
search the data for cells containing the incorrect string length.




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default Finding cells of different string length.

Sorry Charlie
But the fastest way to do this would be a macro. To test the code make a
copy of your workbook. Open the copy of your workbook. Hold down the Alt +
F11 keys this will take you to the vba part ofexcel. You will see a panel on
your left. You will also see something named VBAProject
(NameofYourWorkbook.xls). Right click on the bold print and select Insert
Module. Paste the code in the window to right. Hold down the Alt + F11 keys
again to return to excel. Hold down the Alt + F8 keys to bring up the macro
dialog box. You will see stringLength. Double click or highlight and select
run.
Sub stringLength()
Const whatColumn = "A" 'Change to your needs
Dim looper As Long 'looper = 5 Starting row of data change to your needs
Dim lastToCheckRow As Long
Dim cellPointer As Variant

lastToCheckRow = Range(whatColumn & Rows.Count).End(xlUp).Row

For looper = 5 To lastToCheckRow
Set cellPointer = Worksheets("Sheet1").Cells(looper, 1)
If Len(cellPointer) < 9 Then
MsgBox "Range(" & cellPointer.Address & ")" _
& "Text length is: " & Len(cellPointer)
End If
Next looper
End Sub
"kingie" wrote:

Hi Mike,
Sorry if I sound thick but that went straight over my head, any chance you
could tell me step by step where and what to put into the worksheet?
Thanks for answering
Regards
Charlie.
"Mike" wrote:

This will look at Row 5 down to the last used row in column A

Sub stringLength()
Const whatColumn = "A" 'Change to your needs
Dim looper As Long 'looper = 5 Starting row of data change to your needs
Dim lastToCheckRow As Long
Dim cellPointer As Variant

lastToCheckRow = Range(whatColumn & Rows.Count).End(xlUp).Row

For looper = 5 To lastToCheckRow
Set cellPointer = Worksheets("Sheet1").Cells(looper, 1)
If Len(cellPointer) < 9 Then
MsgBox cellPointer.Address
End If
Next looper
End Sub

"kingie" wrote:

The database i used was supplied in notepad form. It had 1000000 codes in it.
Each code was 8 characters long plus a space making each string length 9.
When the job went wrong and we had several thousand codes printed
incorrectly. I checked the dat and found that 4 of the codes were 8 character
without a space. To find them i copied and pasted all the data into an excel
worksheet. This gave me approximately 14 columns with 65536 cells in each. I
then set up a calculation for each cell =(lens A1)+1000000 Then dragged it
down and across to give a result for each cell. This all took hours. Then i
did a find on the result looking for cells with a value of 1000008 This gave
me my answer but didn't tell another cell only had 5 characters in it. So we
had another mishap whem printing the data. I am sure there must be an easier
way.
Thanks for your help.
Regards
charlie

"Fred Smith" wrote:

Where is the string length stored?

To find the length of a cell A1, for example, use =len(a1). Then compare
this to the string length.

Regards,
Fred.

"kingie" wrote in message
...
Hi,
I have a large table of data that is used to print random codes. The data
is
started as an excel file which is then changed to notepad due to the large
quantity of codes. The ink jet printer that extracts the code uses the
string length to know where it starts and finishes each code. If there is
a
cell with the wrong string length the whole thing goes out of sync. How
can I
search the data for cells containing the incorrect string length.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
String length jxbeeman Excel Discussion (Misc queries) 1 January 10th 08 07:01 PM
Limit to string length in search@replace? Richard Fangnail Excel Discussion (Misc queries) 0 August 14th 07 06:22 PM
creating numbers to a fixed length string... ds Excel Worksheet Functions 4 July 5th 07 01:06 AM
length of text string goes beyond cells are not visible Tom Excel Discussion (Misc queries) 3 November 2nd 05 11:23 PM
fixed string length,even other record is copied viv Excel Discussion (Misc queries) 0 May 30th 05 08:28 PM


All times are GMT +1. The time now is 09:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"