Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
How can I do this in Excel?
I have 2 cells: A1="Bob", B1="Bob, Joe"
or it could be: A1="Bob", B1="Joe"
or A1="", B1="Joe"
or A1="Joe", B1=""
etc.I want to check if B1 contains the text from A1, and if not, concatenate them together in C1, otherwise C1=B1. Here is one way I tried it:
C1:=IF(FIND(A1,B1)>0,B1,CONCATENATE(B1,", ",A1))
actually it is a little more complex than that, since I am first checking for blank cells: =IF(A1="",B1,IF(B1="",A1,IF(FIND(A1,B1)>0,B1,CONCATENATE(B1,", ",A1))The problem I'm running into is if you don't find the A1 text in B1, it returns #VALUE! error... instead of the text values. How do you avoid this?

nevermind -- I figured it out -- just need to use 'ISERROR' as part of the formula:
=IF(A1="",B1,IF(B1="",A1,IF(ISERROR(FIND(A1,B1)),CONCATENATE(B1,", ",A),B1)))

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |