#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 39
Default Search function

Hi All,

Is there a way to use the search function to search non "0" value in
cell.

Ex - if i have "110254" in cell A1 - I need the position of non zero
digit in the string of A1.


Thanks, Thyag.

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,202
Default Search function

Is there a way to use the search function to search non "0" value in
cell.

Ex - if i have "110254" in cell A1 - I need the position of non zero
digit in the string of A1.


Try this (note, there is no 0 in the list)...

=SEARCH({1,2,3,4,5,6,7,8.9},A1)

Rick
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 39
Default Search function

On Aug 10, 10:22 am, "Rick Rothstein \(MVP - VB\)"
wrote:
Is there a way to use the search function to search non "0" value in
cell.


Ex - if i have "110254" in cell A1 - I need the position of non zero
digit in the string of A1.


Try this (note, there is no 0 in the list)...

=SEARCH({1,2,3,4,5,6,7,8.9},A1)

Rick


Thank you Rick.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 39
Default Search function

On Aug 10, 10:49 am, Thyag wrote:
On Aug 10, 10:22 am, "Rick Rothstein \(MVP - VB\)"

wrote:
Is there a way to use the search function to search non "0" value in
cell.


Ex - if i have "110254" in cell A1 - I need the position of non zero
digit in the string of A1.


Try this (note, there is no 0 in the list)...


=SEARCH({1,2,3,4,5,6,7,8.9},A1)


Rick


Thank you Rick.


But the formula checks only the existence of "1" and "2" to "9" is not
validated.


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default Search function

"Rick Rothstein (MVP - VB)" wrote...
....
Ex - if i have "110254" in cell A1 - I need the position of non zero
digit in the string of A1.


Try this (note, there is no 0 in the list)...

=SEARCH({1,2,3,4,5,6,7,8.9},A1)


Note the typo 8.9 rather than 8,9.

The corrected formula would return the array

{1,4,#VALUE!,6,5,#VALUE!,#VALUE!,#VALUE!}

Note, however, that A1 contains 5 nonzero numerals, but the formula returns
only 4 positions - it misses the position of the 2nd '1'. If all these
positions were needed, one way would be using the defined names

nonzero: ={1,2,3,4,5,6,7,8,9}&""

seq: ={1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16}

then the formula

=IF(MID(A1,seq,1)=nonzero,seq,0)

would return a 16-row by 9-column array result. If the ith character in A1
were a nonzero numeral, the ith row of this array would have i in the column
corresponding to that numeral's position in the array named nonzero and "-"
in all other columns.

For example, if A1 were "620259", the array result would be

0 0 0 0 0 1 0 0 0
0 2 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 4 0 0 0 0 0 0 0
0 0 0 0 5 0 0 0 0
0 0 0 0 0 0 0 0 6
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0

The position of the jth nonzero numberal could be found using the array
formula

=SMALL(IF(MMULT(IF(MID(A1,seq,1)=nonzero,seq,0),
TRANSPOSE(nonzero)^0)0,seq),j)

and checking whether the kth character in A1 were a nonzero numeral could be
done using

=COUNT(MATCH(MID(A1,5,1),nonzero,0))0

There are probably better, more compact ways to do what the OP actually
wants to do, but for the general case array processing is unavoidable.




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Search function

You've got lots of responses to all your other posts, too.

Thyag wrote:

Hi All,

Is there a way to use the search function to search non "0" value in
cell.

Ex - if i have "110254" in cell A1 - I need the position of non zero
digit in the string of A1.

Thanks, Thyag.


--

Dave Peterson
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
SEARCH function help Eric Shamlin Excel Worksheet Functions 2 May 4th 06 01:25 AM
SEARCH function jcastellano Excel Worksheet Functions 5 April 3rd 06 03:53 PM
Search function se01rw Excel Discussion (Misc queries) 1 February 13th 06 02:06 PM
Search and Get Function Help angelsimpson Excel Worksheet Functions 10 June 1st 05 06:01 PM
a search function jacko Excel Worksheet Functions 1 June 1st 05 12:51 PM


All times are GMT +1. The time now is 05:41 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"