+ Reply to Thread
Results 1 to 9 of 9

Modify an existing Excel “Substitute function” formula to return “Empty Cell

  1. #1
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    686

    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”

    Thanks for your help in advance

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 2000/3/7/10/13/16
    Posts
    50,107

    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",""))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    686

    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.

  4. #4
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    686

    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.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 2000/3/7/10/13/16
    Posts
    50,107

    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",""))

  6. #6
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    686

    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.

  7. #7
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    686

    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.

    Thanks for your time and efforts in advance.

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 2000/3/7/10/13/16
    Posts
    50,107

    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?

  9. #9
    Forum Contributor
    Join Date
    02-06-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2010
    Posts
    686

    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",""))

    Again, thank you for your assistance in advance.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1