Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Finding a value in one of two columns

I have a spreadsheet where column A contains 4 character department codes
i.e. A123 and column B contains multiple 4 character department codes
separated by commas. I want to find the value A123 in either column A or
column B and if found put a Yes in column C and if not found then put a No in
column C for that row. I have tried several different functions and
combinations of functions but I can't seem to get reliable results.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Finding a value in one of two columns

Put this formula in C1 and then copy down as far as you like...

=IF(A1&B1="","",IF(ISERROR(SEARCH("A123",A1&B1))," No","Yes"))

Rick


"S Shipley" wrote in message
...
I have a spreadsheet where column A contains 4 character department codes
i.e. A123 and column B contains multiple 4 character department codes
separated by commas. I want to find the value A123 in either column A or
column B and if found put a Yes in column C and if not found then put a No
in
column C for that row. I have tried several different functions and
combinations of functions but I can't seem to get reliable results.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Finding a value in one of two columns

Well, technically, this formula could produce a false "Yes" (depending on
whether two department codes can be concatenated so that an embedded
department code can be found inside the concatenated text). This formula
should work no matter what your department codes look like...

=IF(A1&CHAR(1)&B1=CHAR(1),"",IF(ISERROR(SEARCH("A1 23",A1&CHAR(1)&B1)),"No","Yes"))

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
Put this formula in C1 and then copy down as far as you like...

=IF(A1&B1="","",IF(ISERROR(SEARCH("A123",A1&B1))," No","Yes"))

Rick


"S Shipley" wrote in message
...
I have a spreadsheet where column A contains 4 character department codes
i.e. A123 and column B contains multiple 4 character department codes
separated by commas. I want to find the value A123 in either column A or
column B and if found put a Yes in column C and if not found then put a
No in
column C for that row. I have tried several different functions and
combinations of functions but I can't seem to get reliable results.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Finding a value in one of two columns

Thanks Rick,

This solved the problem - I should have written the post earlier and I
wouldn't have pulled so much hair out.

"Rick Rothstein (MVP - VB)" wrote:

Well, technically, this formula could produce a false "Yes" (depending on
whether two department codes can be concatenated so that an embedded
department code can be found inside the concatenated text). This formula
should work no matter what your department codes look like...

=IF(A1&CHAR(1)&B1=CHAR(1),"",IF(ISERROR(SEARCH("A1 23",A1&CHAR(1)&B1)),"No","Yes"))

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
Put this formula in C1 and then copy down as far as you like...

=IF(A1&B1="","",IF(ISERROR(SEARCH("A123",A1&B1))," No","Yes"))

Rick


"S Shipley" wrote in message
...
I have a spreadsheet where column A contains 4 character department codes
i.e. A123 and column B contains multiple 4 character department codes
separated by commas. I want to find the value A123 in either column A or
column B and if found put a Yes in column C and if not found then put a
No in
column C for that row. I have tried several different functions and
combinations of functions but I can't seem to get reliable results.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Finding a value in one of two columns

Thanks Rick,

You are welcome.

This solved the problem - I should have written the post earlier
and I wouldn't have pulled so much hair out.


You wrote that to a bald man

https://mvp.support.microsoft.com/pr...Rick.Rothstein)

so you won't get too much sympathy for your missing hair from me.<bg

Rick
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
Finding matches in two columns Erik Excel Worksheet Functions 4 April 26th 10 03:32 AM
Finding E-mails in different columns and trying to put them in one James Excel Worksheet Functions 1 February 11th 09 12:21 PM
Help finding the length of two different columns willz99ta via OfficeKB.com Excel Programming 4 March 17th 06 05:13 PM
Finding difference between two columns Jim Bancroft[_2_] Excel Programming 1 October 9th 04 03:38 AM
Finding Max Within 3 Columns ClareMarie Excel Programming 6 April 23rd 04 05:43 PM


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