Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default Comparing Text to Several Cells

I am trying to compare the word in one specific cell to the word in several
other cells in a single column. The purpose is that the cell were the code is
should display a specific word if the comparision is equal, if not it should
display the word in the specific cell you want to compare with the column.

I have managed to do this but in the way I do it I have to write a hell of a
lot of code since it is many cells that the specific cell should be compared
to. This is probably easily solved, or at least it feals like it should be
easily solved if you know the program a bit better. The code I use is:


=IF(OR(I6=B4;I6=B5;I6=B6;I6=B7;I6=B8;I6=B9;I6=B10; I6=B11;I6=B12);B2;I6)


As you see I now compare cell "I6" with cells B4 to B12 why the code isn't
redicolously long but I would like to compare to many more cells and then it
will be. My initial fealing was to write B4:B12 but this gave the error
"#value" which is natural since ":" make a sum but it is something similar I
would like to do, short and simple.

If anybody has a solution to this I would be highly grateful.

thanks
Pontus
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 99
Default Comparing Text to Several Cells

Hi Pontus,

Try
=ISNUMBER(MATCH(I6,$B$4:$B$39,0))

Ed Ferrero
www.edferrero.com

I am trying to compare the word in one specific cell to the word in several
other cells in a single column. The purpose is that the cell were the code
is
should display a specific word if the comparision is equal, if not it
should
display the word in the specific cell you want to compare with the column.

I have managed to do this but in the way I do it I have to write a hell of
a
lot of code since it is many cells that the specific cell should be
compared
to. This is probably easily solved, or at least it feals like it should be
easily solved if you know the program a bit better. The code I use is:


=IF(OR(I6=B4;I6=B5;I6=B6;I6=B7;I6=B8;I6=B9;I6=B10; I6=B11;I6=B12);B2;I6)


As you see I now compare cell "I6" with cells B4 to B12 why the code isn't
redicolously long but I would like to compare to many more cells and then
it
will be. My initial fealing was to write B4:B12 but this gave the error
"#value" which is natural since ":" make a sum but it is something similar
I
would like to do, short and simple.

If anybody has a solution to this I would be highly grateful.

thanks
Pontus


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 99
Default Comparing Text to Several Cells

Or, closer to what you actually asked for...

=IF(ISNUMBER(MATCH(I6,$B$4:$B$39,0)),B2,I6)

Ed Ferrero
www.edferrero.com

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default Comparing Text to Several Cells

Hi Ed,

Thank you very much for your help. This looks like a really good solution
which I really like. However, I can not get "MATCH" to function properly. I
tried to read up on it and in the help it says that it should function with
text (which I use) but I only get #N/A value. This is what "MATCH" is suposed
to return when it cannot find a match.

Since I always get #N/A, "ISNUMBER" always returns false and you understand
that it wont give the result I want.

Do you have any idea to why this is so??

By the way, I don't know if it is because of an old version but I have to
exchange all the ":" to ";" to seperate the values in the function. Maybe
thats nothing strange.

//Pontus

"Ed Ferrero" wrote:

Or, closer to what you actually asked for...

=IF(ISNUMBER(MATCH(I6,$B$4:$B$39,0)),B2,I6)

Ed Ferrero
www.edferrero.com


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default Comparing Text to Several Cells

Hi Ed,

I'm sorry, it did function =D In some of my texts I had ended with a blank
space while the "look-up value" was not so that why it didn't function in the
biggining. I guess one have to be a bit careful when one type in or
copy-paste so that it doesn't end with a blank space.

Thank you very much for your help, this was the first time I posed a Q here
and I am really glad you helped me =)

Take care and have a nice weekend!
//a very grateful Pontus

"Pontus" wrote:

Hi Ed,

Thank you very much for your help. This looks like a really good solution
which I really like. However, I can not get "MATCH" to function properly. I
tried to read up on it and in the help it says that it should function with
text (which I use) but I only get #N/A value. This is what "MATCH" is suposed
to return when it cannot find a match.

Since I always get #N/A, "ISNUMBER" always returns false and you understand
that it wont give the result I want.

Do you have any idea to why this is so??

By the way, I don't know if it is because of an old version but I have to
exchange all the ":" to ";" to seperate the values in the function. Maybe
thats nothing strange.

//Pontus

"Ed Ferrero" wrote:

Or, closer to what you actually asked for...

=IF(ISNUMBER(MATCH(I6,$B$4:$B$39,0)),B2,I6)

Ed Ferrero
www.edferrero.com




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
Comparing cells and output text Rocketeer Excel Worksheet Functions 7 May 19th 08 12:14 AM
Comparing text within cells in two columns Billing Excel Worksheet Functions 2 April 30th 07 02:00 PM
Comparing cells with text Mortir Excel Worksheet Functions 4 January 3rd 07 10:54 PM
comparing text cells Comander Excel Worksheet Functions 2 June 5th 06 10:00 PM
Comparing text strings in cells Andy Excel Discussion (Misc queries) 0 January 11th 06 10:38 AM


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