Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default searching for a type of string

I use the following to search for "M" at the end of a word :

=IF(EXACT(RIGHT(A1,1),"M"),1,0)

it returns 1 for true and 0 for false.

This is fine, but I need to expand the expression so that it returns 1 only
if the end of the string is a number followed by M.

For example :

xxxM = 0
3.2M =1
xxxm = 0
xxx m = 0
5M = 1
6.0M = 1

Can anyone help?

Thanks, Roger
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default searching for a type of string

Hi Roger

This should do what you wish, provided there is one character at the
end of your string as text as you had in your example. If there are
more you may need something else.

=IF(ISNUMBER(VALUE((MID(A1,1,LEN(A1)-1)))),1,0)

Take care

Marcus
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default searching for a type of string

On Mon, 4 Jan 2010 17:40:02 -0800, Roger on Excel
wrote:

I use the following to search for "M" at the end of a word :

=IF(EXACT(RIGHT(A1,1),"M"),1,0)

it returns 1 for true and 0 for false.

This is fine, but I need to expand the expression so that it returns 1 only
if the end of the string is a number followed by M.

For example :

xxxM = 0
3.2M =1
xxxm = 0
xxx m = 0
5M = 1
6.0M = 1

Can anyone help?

Thanks, Roger



=SUMPRODUCT(--ISNUMBER(FIND({1,2,3,4,5,6,7,8,9,0}&"M",RIGHT(A1,2 ))))

--ron
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default searching for a type of string

Give this a try...

=ISNUMBER(--MID(A1,LEN(A1)-1,1))*EXACT(RIGHT(A1),"M")

--
Rick (MVP - Excel)


"Roger on Excel" wrote in message
...
I use the following to search for "M" at the end of a word :

=IF(EXACT(RIGHT(A1,1),"M"),1,0)

it returns 1 for true and 0 for false.

This is fine, but I need to expand the expression so that it returns 1
only
if the end of the string is a number followed by M.

For example :

xxxM = 0
3.2M =1
xxxm = 0
xxx m = 0
5M = 1
6.0M = 1

Can anyone help?

Thanks, Roger


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default searching for a type of string

Here is another way...

=ISNUMBER(FIND("x"&RIGHT(A1,2)&"x","x0Mx1Mx2Mx3Mx4 Mx5Mx6Mx7Mx8Mx9Mx"))

It's longer, but it uses less function calls.

--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message
...
Give this a try...

=ISNUMBER(--MID(A1,LEN(A1)-1,1))*EXACT(RIGHT(A1),"M")

--
Rick (MVP - Excel)


"Roger on Excel" wrote in message
...
I use the following to search for "M" at the end of a word :

=IF(EXACT(RIGHT(A1,1),"M"),1,0)

it returns 1 for true and 0 for false.

This is fine, but I need to expand the expression so that it returns 1
only
if the end of the string is a number followed by M.

For example :

xxxM = 0
3.2M =1
xxxm = 0
xxx m = 0
5M = 1
6.0M = 1

Can anyone help?

Thanks, Roger



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
Searching csv files for particular string Iain M Excel Programming 0 January 22nd 07 10:41 AM
searching through a string? funkymonkUK[_144_] Excel Programming 6 May 3rd 06 02:19 PM
changing the default type of searching in the find function Jose Roberto Excel Discussion (Misc queries) 1 November 29th 05 12:51 AM
Searching a String dcstech Excel Programming 2 April 6th 04 02:41 PM
searching a string with a partial string dcstech Excel Programming 1 April 5th 04 10:57 PM


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