Forum Discussion

User5105's avatar
User5105
Copper Contributor
Nov 06, 2023

If blank formula addition to be added to current formula.

Please help

 

I am struggling to get my formula correct, I currently have the below data in Cell A1: 

1234 (09-07-2013) Sample. With a formula to extract only the data in brackets as:

=MID(A2;FIND("(";A2)+1; FIND(")";A2)- FIND("(";A2)-1)

 

I now want to add a condition that if there is no data inside the brackets () that the cell should be blank.

 

I would appreciate any assistance with this.

  • LeonPavesic's avatar
    LeonPavesic
    Silver Contributor

    Hi User5105,

    To make your existing formula return a blank cell when there is no data inside the brackets, you can use the following formula with an `IF` statement:

     

    =IF(ISNUMBER(FIND("(", A1)), MID(A1, FIND("(", A1) + 1, FIND(")", A1) - FIND("(", A1) - 1), "")

     

    This formula checks if an open parenthesis "(" exists in cell A1 by using `ISNUMBER(FIND("(", A1))`. If it does, the formula proceeds to extract the data inside the brackets using the `MID` function. If there's no open parenthesis, it returns an empty string, effectively making the cell blank.

    Please click Mark as Best Response & Like if my post helped you to solve your issue.
    This will help others to find the correct solution easily. It also closes the item.


    If the post was useful in other ways, please consider giving it Like.


    Kindest regards,


    Leon Pavesic
    (LinkedIn)

Resources