Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
mark
 
Posts: n/a
Default count of tab characters in a single cell

Hi.

I have an application that I wrote a while ago that is having a little bit
of problem with bogus data being given to it.

The input is a tab separated variable file, where every record of data
should have the same number of tab characters.

I'm thinking of inputting the file all into one column, and then counting
the number of tab characters in a given cell, to check if all of the input
records are valid. My guess is that one of the users is going in and
manipulating the text file after it comes from it's source, and manually
changing a tab to spaces, etc.

The tab character can be identified by the function code(9) .

My question is this, can someone help me come up with a formula that will
count the number of tab characters in a given cell's content?

I could work it into a loop, but it would run much faster if I can just do
it with a count type function, but I haven't seen the one I need, yet.

Thanks.
Mark
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bernard Liengme
 
Posts: n/a
Default count of tab characters in a single cell

=LEN(A1)-LEN(SUBSTITUTE(A1,CHAR(9),""))
best wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"mark" wrote in message
...
Hi.

I have an application that I wrote a while ago that is having a little bit
of problem with bogus data being given to it.

The input is a tab separated variable file, where every record of data
should have the same number of tab characters.

I'm thinking of inputting the file all into one column, and then counting
the number of tab characters in a given cell, to check if all of the input
records are valid. My guess is that one of the users is going in and
manipulating the text file after it comes from it's source, and manually
changing a tab to spaces, etc.

The tab character can be identified by the function code(9) .

My question is this, can someone help me come up with a formula that will
count the number of tab characters in a given cell's content?

I could work it into a loop, but it would run much faster if I can just do
it with a count type function, but I haven't seen the one I need, yet.

Thanks.
Mark



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary''s Student
 
Posts: n/a
Default count of tab characters in a single cell

Looking at A9:

=LEN(A9)-LEN(SUBSTITUTE(A9,CHAR(9),""))

will display the number of tab characters

--
Gary''s Student


"mark" wrote:

Hi.

I have an application that I wrote a while ago that is having a little bit
of problem with bogus data being given to it.

The input is a tab separated variable file, where every record of data
should have the same number of tab characters.

I'm thinking of inputting the file all into one column, and then counting
the number of tab characters in a given cell, to check if all of the input
records are valid. My guess is that one of the users is going in and
manipulating the text file after it comes from it's source, and manually
changing a tab to spaces, etc.

The tab character can be identified by the function code(9) .

My question is this, can someone help me come up with a formula that will
count the number of tab characters in a given cell's content?

I could work it into a loop, but it would run much faster if I can just do
it with a count type function, but I haven't seen the one I need, yet.

Thanks.
Mark

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
mark
 
Posts: n/a
Default count of tab characters in a single cell

Thanks... exactly what I was looking for.

Of coure, now that you've told me that, I'm finding that there might be more
problems with the file than I thought, but hey... that's what I need to know!

Thanks.

"Gary''s Student" wrote:

Looking at A9:

=LEN(A9)-LEN(SUBSTITUTE(A9,CHAR(9),""))

will display the number of tab characters


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
mark
 
Posts: n/a
Default count of tab characters in a single cell

Thanks... I've never used the substitute function was the problem (why I
didn't think of it).. but this will work great.



"Bernard Liengme" wrote:

=LEN(A1)-LEN(SUBSTITUTE(A1,CHAR(9),""))
best wishes
--



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bernard Liengme
 
Posts: n/a
Default count of tab characters in a single cell

Chip at www.cpearson.com has a macro for identifying/removing special
characters.
good luck!
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"mark" wrote in message
...
Hi.

I have an application that I wrote a while ago that is having a little bit
of problem with bogus data being given to it.

The input is a tab separated variable file, where every record of data
should have the same number of tab characters.

I'm thinking of inputting the file all into one column, and then counting
the number of tab characters in a given cell, to check if all of the input
records are valid. My guess is that one of the users is going in and
manipulating the text file after it comes from it's source, and manually
changing a tab to spaces, etc.

The tab character can be identified by the function code(9) .

My question is this, can someone help me come up with a formula that will
count the number of tab characters in a given cell's content?

I could work it into a loop, but it would run much faster if I can just do
it with a count type function, but I haven't seen the one I need, yet.

Thanks.
Mark



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
How to set number of characters within a cell in Excel 2003? aqmdtran Excel Worksheet Functions 2 May 4th 06 05:10 PM
Urgent date/scheduling calc needed jct Excel Worksheet Functions 3 February 24th 06 01:36 AM
How to copy single cell into cell that is merged from two cells? Rod Excel Discussion (Misc queries) 3 January 22nd 06 09:24 PM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
Paste rows of numbers from Word into single Excel cell BecG Excel Discussion (Misc queries) 1 December 8th 04 04:55 PM


All times are GMT +1. The time now is 09:19 AM.

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"