Compare two cells in different columns, return value based on multiple conditions

Beeftank

New Member
Joined
Apr 9, 2015
Messages
8
Hello,

I have 3 columns E, F, and G. The cells in columns F and G are formula based that reference another worksheet. They either return an error or a text value.

I need a formula in E3 that will look at F3 and G3 and return a value based on the following conditions:

If F3 and G3 are both errors, show nothing
If F3=G3, show F3
If F3 is an error, but G3 is any text value, show G3
If G3 is an error, but F3 is any text value, show F3

Of note, if both F3 and G3 have text values, they will always be the same value. Below is what I have tried which works in the cases of F3=G3 as well as F3 and G3 both being errors, but not for any other condition.

VBA Code:
=IF(AND(ISERROR(F3),ISERROR(G3)),"",IF(F3=G3,F3,IF(AND(ISERROR(F3),ISTEXT(G3)),G3,IF(AND(ISERROR(G3),ISTEXT(F3)),F3,""))))

I appreciate the help in advanced!
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
I'm glad to help you. Thanks for the feedback.
 
Upvote 0
This was a far more simplified solution than what I came up with ..
Her is a slightly simpler (that is, two less functions required) one again.

=IFERROR(F3,IFERROR(G3,""))
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

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