Hi,

I'm trying to SUBSTITUTE one of two text values depending on what is in the cell to the left.

Formula I've tried is:

=IF(SEARCH("XXXX",B1),SUBSTITUTE(B1,$G$1,$H$1),(SEARCH("YYYY",B1),SUBSTITUTE(B1,$G$2,$H$2)))
Each half works separately
=IF(SEARCH("XXXX",B1),SUBSTITUTE(B1,$G$1,$H$1)
or
=IF(SEARCH("YYYY",B1),SUBSTITUTE(B1,$G$2,$H$2)
but when I try to combine them I cannot get it to work.

Any ideas?

Thanks