View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default search text string for number

If post code is the only numeric in the address try the below formula and
feedback. Please note that this is an array formula. Within the cell in edit
mode (F2) paste this formula and press Ctrl+Shift+Enter to apply this
formula. If successful in 'Formula Bar' you can notice the curly braces at
both ends like "{=<formula}"

With your address text in cell A1 try the below formula B1(array entered)

A1 = cross road,town,county, 2600

=IF(AND(COUNT(1*MID(MID(A1,MIN(SEARCH({0,1,2,3,4,5 ,6,7,8,9},A1&"0123456789")),99),ROW(1:99),1))=4,--MID(A1,MATCH(TRUE,ISNUMBER(1*MID(A1,ROW(1:99),1)), 0),4)=600,--MID(A1,MATCH(TRUE,ISNUMBER(1*MID(A1,ROW(1:99),1)), 0),4)<=9990),MID(A1,MATCH(TRUE,ISNUMBER(1*MID(A1,R OW(1:99),1)),0),4),"")

If this post helps click Yes
---------------
Jacob Skaria


"Sooz" wrote:

I want a formula that will search a cell and identify whether that cell
contains a postcode or not - and return that postcode. A postcode is
identified as being a 4 digit number between 0600 and 9990.

Ideally it won't matter where in the text the postcode appears. The cell
will be a text (address) field.