Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dbs dbs is offline
external usenet poster
 
Posts: 18
Default matching a format in a lookup

In column A I have numbers in different formats. Some 6 digits alpha
numeric, some are 6 digits followed by 3 digits and separated with a dash
(6-3). Another group is similar: 2 digits - 5 digits - 2 digits (2-5-2). In
column B I'd like to insert a function (e.g. IF statement) that would respond
(yes, etc) when the adjacent cell in column A contained a 2-5-2 number. Does
anyone have a idea of how to do this? Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default matching a format in a lookup

One way:

=IF(AND(ISNUMBER(-SUBSTITUTE(A1,"-","")), MID(A1,3,1)="-",
MID(A1,9,1)="-"), "yes", "no")

This will work for the examples given. However, note that it will also
return "yes" for a number pattern 2-2-2-2.



In article ,
dbs wrote:

In column A I have numbers in different formats. Some 6 digits alpha
numeric, some are 6 digits followed by 3 digits and separated with a dash
(6-3). Another group is similar: 2 digits - 5 digits - 2 digits (2-5-2). In
column B I'd like to insert a function (e.g. IF statement) that would respond
(yes, etc) when the adjacent cell in column A contained a 2-5-2 number. Does
anyone have a idea of how to do this? Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
dbs dbs is offline
external usenet poster
 
Posts: 18
Default matching a format in a lookup

Thank you. My 2-5-2 is actually an alphanumeric so I had to tweak your
solution. But it worked great!! Thanks.

"JE McGimpsey" wrote:

One way:

=IF(AND(ISNUMBER(-SUBSTITUTE(A1,"-","")), MID(A1,3,1)="-",
MID(A1,9,1)="-"), "yes", "no")

This will work for the examples given. However, note that it will also
return "yes" for a number pattern 2-2-2-2.



In article ,
dbs wrote:

In column A I have numbers in different formats. Some 6 digits alpha
numeric, some are 6 digits followed by 3 digits and separated with a dash
(6-3). Another group is similar: 2 digits - 5 digits - 2 digits (2-5-2). In
column B I'd like to insert a function (e.g. IF statement) that would respond
(yes, etc) when the adjacent cell in column A contained a 2-5-2 number. Does
anyone have a idea of how to do this? Thanks.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 186
Default matching a format in a lookup

Might this work...

=IF(AND(ISNUMBER(VALUE(LEFT(A1,2))),MID(A1,3,1)="-",ISNUMBER(VALUE(MID(A1,4,5))),MID(A1,9,1)="-",ISNUMBER(VALUE(RIGHT(A1,2)))),"Yes","No")
--
Ken Hudson


"dbs" wrote:

In column A I have numbers in different formats. Some 6 digits alpha
numeric, some are 6 digits followed by 3 digits and separated with a dash
(6-3). Another group is similar: 2 digits - 5 digits - 2 digits (2-5-2). In
column B I'd like to insert a function (e.g. IF statement) that would respond
(yes, etc) when the adjacent cell in column A contained a 2-5-2 number. Does
anyone have a idea of how to do this? Thanks.

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
Lookup matching two values Nick Ng[_2_] Excel Worksheet Functions 4 November 4th 09 02:23 AM
matching or lookup functions anand Excel Worksheet Functions 3 February 21st 09 05:08 PM
lookup the next matching record. tess Excel Worksheet Functions 5 April 4th 07 03:17 PM
matching and lookup?? eoht Excel Worksheet Functions 3 November 11th 05 01:51 AM
matching and lookup?? Duke Carey Excel Worksheet Functions 0 November 10th 05 08:55 PM


All times are GMT +1. The time now is 06:49 PM.

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

About Us

"It's about Microsoft Excel"