+ Reply to Thread
Results 1 to 4 of 4

Verify all parenthesis are closed

  1. #1
    Forum Contributor
    Join Date
    06-17-2012
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    150

    Verify all parenthesis are closed

    I have a column in Excel with formulas written as text. For example, "Product A = (B + (C - D))" all as text.

    I noticed some of these formulas do not have all their parenthesis closed. For Example, "Product A = (B + (C - D)" as text.

    Is there a way to check that for every open parenthesis "(" there is a closed parenthesis ")"

    I just cannot think of a way to approach this.

    Thanks.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,791

    Re: Verify all parenthesis are closed

    You can use this formula in B1:

    =LEN(A1)-LEN(SUBSTITUTE(A1,"(",""))

    to tell you how many open brackets you have. A similar formula in C1:

    =LEN(A1)-LEN(SUBSTITUTE(A1,")",""))

    can tell you how many closed brackets you have.

    Hope this helps.

    Pete

  3. #3
    Forum Contributor
    Join Date
    06-17-2012
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    150

    Re: Verify all parenthesis are closed

    Pete,

    This is great.

    Once I determine the total missing parenthesis, how can I identify the spot to insert the missing parenthesis?

    Thanks.

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,791

    Re: Verify all parenthesis are closed

    For that you would need a full syntax checker - that's a bit beyond the scope of a formula !!

    Pete

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Parenthesis Help
    By Helgard25 in forum Excel General
    Replies: 5
    Last Post: 03-20-2015, 07:00 AM
  2. [SOLVED] Need formula to Get the count of closed In closed DBD through orderno of Dispatchsheet
    By johnodys in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-19-2014, 01:49 AM
  3. Parenthesis Help with SQL in VBA
    By jo15765 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-01-2012, 03:32 AM
  4. Missing parenthesis
    By docrobo in forum Excel General
    Replies: 3
    Last Post: 10-23-2011, 05:18 PM
  5. Parenthesis
    By John Abbot in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-10-2007, 09:49 AM
  6. [SOLVED] what are parenthesis in formulas?
    By ann in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 08-21-2006, 05:45 PM
  7. Parenthesis
    By GitFinger in forum Excel General
    Replies: 2
    Last Post: 03-31-2006, 10:30 AM

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