# Modify an existing Excel Substitute function formula to return Empty Cell

1. ## Modify an existing Excel Substitute function formula to return Empty Cell

I have a substitute formula that is working great. I need a modification to the substitute formula so that it returns an Empty Cell when there is Brown, Purple and Blue in any cells in column A.

Existing Formula: =IF(AND(SUBSTITUTE(B2," ","")="AlmondPapayaPapaya",OR(C2={"Home","Key","Door"})),"Yes","")

New Scenarios:
IF A2 = Brown and B2 = Almond Papaya Papaya, return Empty cell
IF A5 = Purple and and B5 = Almond Papaya Papaya, return Empty cell
IF A12 = Blue and and B12 = Almond Papaya Papaya, return Empty cell  Register To Reply

2. ## Re: Modify an existing Excel Substitute function formula to return Empty Cell

Add an extra if at the start...
=if(or(and(A2="Brown",B2="Almond Papaya Papaya"),and(A5="Purple",B5="Almond Papaya Papaya"),and(A12="Blue",B12="Almond Papaya Papaya")),"Empty Cell", IF(AND(SUBSTITUTE(B2," ","")="AlmondPapayaPapaya",OR(C2={"Home","Key","Door"})),"Yes",""))  Register To Reply

3. ## Re: Modify an existing Excel Substitute function formula to return Empty Cell

FDibbins: Thank you so much for the response. If there a way to use the Substitute function for the added IF part (=If(or(and(A2="Brown",B2="Almond Papaya Papaya"),and(A5="Purple",B5="Almond Papaya Papaya"),and(A12="Blue",B12="Almond Papaya Papaya")),"Empty Cell") to accommodate spaces (single, double, triple or no space) between "Almond Papaya Papaya". Thanks alot.  Register To Reply

4. ## Re: Modify an existing Excel Substitute function formula to return Empty Cell

I meant to say: Is there a way to use the Substitute function for the added IF part to make it consistent with the substitute function used (=If(or(and(A2="Brown",B2="Almond Papaya Papaya"),and(A5="Purple",B5="Almond Papaya Papaya"),and(A12="Blue",B12="Almond Papaya Papaya")),"Empty Cell") to accommodate spaces (single, double, triple or no space) between "Almond Papaya Papaya". Thanks alot.  Register To Reply

5. ## Re: Modify an existing Excel Substitute function formula to return Empty Cell

Cant you just remove the spaces in the formula, rather than add extra substitutes?...
=if(or(and(A2="Brown",B2="AlmondPapayaPapaya"),and(A5="Purple",B5="AlmondPapayaPapaya"),and(A12="Blue",B12="AlmondPapayaPapaya")),"Empty Cell", IF(AND(SUBSTITUTE(B2," ","")="AlmondPapayaPapaya",OR(C2={"Home","Key","Door"})),"Yes",""))  Register To Reply

6. ## Re: Modify an existing Excel Substitute function formula to return Empty Cell

FDibbins: Once again, thanks for the response. The extra substitute is to account for the spaces.  Register To Reply

7. ## Re: Modify an existing Excel Substitute function formula to return Empty Cell

FDibbins:

I tried the formula with the extra spaces removed. However, it did not return the desired outcome because of the spaces in-between “AlmondPapayaPapaya” (the spaces could be single, double, triple or no space at all). And I think adding extra substitutes or applying an Excel function should solve this issue.  Register To Reply

8. ## Re: Modify an existing Excel Substitute function formula to return Empty Cell

Can you post a sample workbook, showing what you have, what you want and how you got that?  Register To Reply

9. ## Re: Modify an existing Excel Substitute function formula to return Empty Cell

FDibbins: Thank you for the response. I was able to make the formula work except that I had to include the spaces in the formula to capture spaces between the words. I still feel this will fail in certain instances where the spaces are not properly captured, a situation by prompted the request for another substitute function to address the spacing issue with the first part of the formula -=if(or(and(A2="Brown",B2="AlmondPapayaPapaya"),and(A5="Purple Pink",B5="AlmondPapayaPapaya"),and(A12="BlueRed",B12="AlmondPapayaPapaya")),"Empty Cell",IF(AND(SUBSTITUTE(B2," ","")="AlmondPapayaPapaya",OR(C2={"Home","Key","Door"})),"Yes",""))  Register To Reply