If two different cells not equal to a text value display the text value in a different

rdoulaghsingh

Board Regular
Joined
Feb 14, 2021
Messages
105
Office Version
  1. 365
Platform
  1. Windows
I have two cells A1 and B2 which contain the default text<Customer Name>. If either of the two cells (one or the other) contain anything other than "<Customer Name>" I want the text to be displayed in another cell K14.
Below is the excel function I have in K14, but I'm missing something. I tried using the OR operator as well, but that doesn't give me the correct output either. I'm also wondering if there is an additional syntax I can add to the function so if one of the two cells with <Customer Name> gets deleted, it doesn't give an #REF! error. Please help!

=IF(AND(A1<>"<Customer Name>",B1<>"<Customer Name>"), A1, B1)
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi,

Try this:

Excel Formula:
=IF(A1<>"<Customer Name>",A1,IF(B1<>"<Customer Name>",B1,""))
 
Upvote 0
Edit, as posted -already have an answer

=IF(A1<>"<Customer Name>",A1 IF( B1<>"<Customer Name>", B1,"")
 
Upvote 0
Hi,

Try this:

Excel Formula:
=IF(A1<>"<Customer Name>",A1,IF(B1<>"<Customer Name>",B1,""))
Thank you for the quick reply. It works! The only thing I am wondering is there a way to not receive an error if one of the cells is deleted? I tried with the If(ISERROR but it doesn't like that.
 
Upvote 0
If one of A1:B1 is deleted, it shouldn't show an error, it should show 0, here's a fix:

Excel Formula:
=IF(AND(A1<>"<Customer Name>",A1<>""),A1,IF(AND(B1<>"<Customer Name>",B1<>""),B1,""))
 
Upvote 0
If one of A1:B1 is deleted, it shouldn't show an error, it should show 0, here's a fix:

Excel Formula:
=IF(AND(A1<>"<Customer Name>",A1<>""),A1,IF(AND(B1<>"<Customer Name>",B1<>""),B1,""))
I meant the actual cell is deleted and not the entry. If the customer name is entered in A1 I'm going to delete the B column containing "<Customer Name>" and vice versa. I have a VBA script which deletes the unused column, so I don't want it to give #Ref! error when that happens.
 
Upvote 0
Hmmm, ok, this will fix it if B column is deleted and formula cell will retain A value, but if A column is deleted, formula cell will become blank:

Excel Formula:
=IFERROR(IF(A1<>"<Customer Name>",A1,IF(B1<>"<Customer Name>",B1,"")),"")
 
Upvote 0
Hmmm, ok, this will fix it if B column is deleted and formula cell will retain A value, but if A column is deleted, formula cell will become blank:

Excel Formula:
=IFERROR(IF(A1<>"<Customer Name>",A1,IF(B1<>"<Customer Name>",B1,"")),"")
You sir are a genius @jtakw !!! That was it! Thank you so much for your help! And thanks to everyone else who took the time to respond @etaf @Saba Sabaratnam.
 
Upvote 0
Hmmm, ok, this will fix it if B column is deleted and formula cell will retain A value, but if A column is deleted, formula cell will become blank:

Excel Formula:
=IFERROR(IF(A1<>"<Customer Name>",A1,IF(B1<>"<Customer Name>",B1,"")),"")
Is it possible to retain column B also if column A is deleted instead of showing blank?
 
Upvote 0

Forum statistics

Threads
1,214,892
Messages
6,122,112
Members
449,066
Latest member
Andyg666

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top