Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 32
Default Search Function Question

How can you make the Search function find a number (any number) in a text
string?

In this example, I would like Search to locate the first number (not just
the number 1, which is in the formula below) after a defined point in the
text string:

SEARCH(1,B2,LEN(TEXT(C2,"d,m,yyyy"))+15)

--
iperlovsky
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 26
Default Search Function Question

Hello,

If I understand what you are trying to do, here is one way to do it.

To find the location of the first numeric character (from the left,
including spaces):

=IF(offset<LEN(A1),IF(MIN(SEARCH({0,1,2,3,4,5,6,7, 8,9},RIGHT(A1,LEN(A1)-offset)&"0123456789"))LEN(A1)-offset,"No
Num",MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},RIGHT(A1,LEN (A1)-offset)&"0123456789"))),IF(A1="","","Reduce
the Offset"))

The formula will check for a numeric character within the string and if none
is found it will return "No Num", otherwise it will return the position of
the first numeric character. The formula also allows for an offset from the
left, meaning a certain number of characters at the beginning of the string
can be ignored in the calculations. Create a named range ("offset")
referencing a single cell and insert the desired value in that cell
representing the number of characters to ignore. If the offset value
happens to be greater than or equal to the string length, the formula
returns "Reduce the Offset".

If you wish to know the value of the first numeric character found in the
string, use the following formula:

=IF(offset<LEN(A2),IF(MIN(SEARCH({0,1,2,3,4,5,6,7, 8,9},RIGHT(A2,LEN(A2)-offset)&"0123456789"))LEN(A2)-offset,"No
Num",RIGHT(LEFT(RIGHT(A2,LEN(A2)-offset),MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},RIGHT(A2, LEN(A2)-offset)&"0123456789"))),1)),IF(A2="","","Reduce
the Offset"))

Bob



"IPerlovsky" wrote in message
...
How can you make the Search function find a number (any number) in a text
string?

In this example, I would like Search to locate the first number (not just
the number 1, which is in the formula below) after a defined point in the
text string:

SEARCH(1,B2,LEN(TEXT(C2,"d,m,yyyy"))+15)

--
iperlovsky



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
Question regarding how to search a column and print a row(s) PegL Excel Discussion (Misc queries) 0 July 15th 05 03:15 PM
Question regarding how to search a column and print a row(s) PegL Excel Worksheet Functions 0 July 15th 05 03:15 PM
Question regarding how to search a column and print a row(s) Max Excel Discussion (Misc queries) 0 July 15th 05 04:14 AM
Search and Replace Question Rebecca New Users to Excel 1 April 11th 05 04:49 AM
Simple Search and Replace Question Rebecca Excel Discussion (Misc queries) 2 April 3rd 05 03:33 PM


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