Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default finding occurance of characters

Hi,

I have the data like the following.

ABAACADAM

I would like to find whther the letter "B" is present in it or not. So,
I used FIND("B",F25) which returned me 2.

but, my objective is to find "B","C","D","W". say for eg, if B is not
present then the letter "C" should be searched and the
occurence/position has to be returned. The order of precedence should
be maintained for the letters to be searched. i.e., if B is not found,
search for C, if not found, search for D and if not found search for W.
if nothing is present I should place 0(zero) in the resultant cell.

Is there any simple solution for this task?

thanks
Easwara

  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default finding occurance of characters

=MIN(IF(MID(A21,ROW(INDIRECT("1:"&LEN(A21))),1)={" B","C","D","W".},ROW(INDIR
ECT("1:"&LEN(A21)))))

which is an array formula, it should be committed with Ctrl-Shift-Enter, not
just Enter.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

wrote in message
oups.com...
Hi,

I have the data like the following.

ABAACADAM

I would like to find whther the letter "B" is present in it or not. So,
I used FIND("B",F25) which returned me 2.

but, my objective is to find "B","C","D","W". say for eg, if B is not
present then the letter "C" should be searched and the
occurence/position has to be returned. The order of precedence should
be maintained for the letters to be searched. i.e., if B is not found,
search for C, if not found, search for D and if not found search for W.
if nothing is present I should place 0(zero) in the resultant cell.

Is there any simple solution for this task?

thanks
Easwara



  #3   Report Post  
Posted to microsoft.public.excel.misc
Max
 
Posts: n/a
Default finding occurance of characters

Another play to try ..

Put in say, G25:
=IF(ISERROR(FIND("B",F25)),IF(ISERROR(FIND("C",F25 )),IF(ISERROR(FIND("D",F25
)),IF(ISERROR(FIND("W",F25)),0,FIND("W",F25)),FIND ("D",F25)),FIND("C",F25)),
FIND("B",F25))
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
wrote in message
oups.com...
Hi,

I have the data like the following.

ABAACADAM

I would like to find whther the letter "B" is present in it or not. So,
I used FIND("B",F25) which returned me 2.

but, my objective is to find "B","C","D","W". say for eg, if B is not
present then the letter "C" should be searched and the
occurence/position has to be returned. The order of precedence should
be maintained for the letters to be searched. i.e., if B is not found,
search for C, if not found, search for D and if not found search for W.
if nothing is present I should place 0(zero) in the resultant cell.

Is there any simple solution for this task?

thanks
Easwara



  #4   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default finding occurance of characters

Thanks Bob & Max!! Both solutions works!! :)

You guys Rock!!

  #5   Report Post  
Posted to microsoft.public.excel.misc
Max
 
Posts: n/a
Default finding occurance of characters

wrote
Thanks Bob & Max!! Both solutions works!! :)
You guys Rock!!


You're welcome ! Thanks for the feedback

But .. there might be some subtle differences <g
... is the order of precedence check still important?,
re your:
... The order of precedence should
be maintained for the letters to be searched.
i.e., if B is not found, search for C, if not found,
search for D and if not found search for W.
if nothing is present .. place 0 (zero) in the resultant cell.


I tested with, say the data: AWAACADAM
Bob's returns: 2 ("W"),
while mine returns: 5 ("C")

With say: AADAMBMM
Bob's returns: 3 ("D"),
while mine returns: 6 ("B")
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---


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
How can I control the length of characters a code will return? Tayo Excel Discussion (Misc queries) 0 April 7th 06 05:22 PM
Finding cells with a specific number of characters Kamran Excel Discussion (Misc queries) 6 March 30th 06 12:04 AM
Formula to replace invalid filename characters tschultz Excel Worksheet Functions 2 January 27th 06 08:07 PM
Help - Can't directly input Japanese characters into cell NKK Excel Discussion (Misc queries) 0 January 3rd 06 03:00 AM
Finding & Capturing First Occurance Pablo Excel Worksheet Functions 1 December 16th 04 11:24 PM


All times are GMT +1. The time now is 05:24 AM.

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"