+ Reply to Thread
Results 1 to 10 of 10

Nested Formula Using VBA

  1. #1
    Forum Contributor
    Join Date
    09-06-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    225

    Nested Formula Using VBA

    I am filling a column with a formula, but I keep getting a compile error: "Expected: )" in the 2nd line of the code at ", "

    Does anyone see what I am doing wrong?

    Please Login or Register  to view this content.
    Thanks for taking a look.

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Nested Formula Using VBA

    Can you post a sample workbook? I feel like I am missing something

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Nested Formula Using VBA

    This won't cause an error but I don't know if it'll produce the formula you want.
    Please Login or Register  to view this content.
    Last edited by Norie; 01-02-2013 at 05:36 PM.
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    07-25-2005
    Location
    Leeds, UK
    MS-Off Ver
    2010
    Posts
    12

    Re: Nested Formula Using VBA

    I converted your code to...

    Please Login or Register  to view this content.
    This gives the formula =OR(I2="",AND(F2>I2, F2>J2)) in cell A1

    Is this what you were after?

  5. #5
    Forum Contributor
    Join Date
    09-06-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    225

    Re: Nested Formula Using VBA

    I should have mentioned, the "i" and "v" are variables.

    I just need it to fill the last column (i9) with the following formula for each row:

    OR(v9="", AND(V6 > v9, v6 > v10))
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-25-2005
    Location
    Leeds, UK
    MS-Off Ver
    2010
    Posts
    12

    Re: Nested Formula Using VBA

    Try this...

    Please Login or Register  to view this content.

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Nested Formula Using VBA

    Have you tried either suggestion?

    What I posted works with the code in the workbook you attached.
    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Nested Formula Using VBA

    Personally, if I'm trying to build a string which includes quotes I always use Chr(34), rather than try to get the double quotes right - it ends up being easier to work with and looks a lot less confusing.

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Nested Formula Using VBA

    Here's a shorter version.
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    09-06-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    225

    Re: Nested Formula Using VBA

    Norie, your first post worked fine. I just didnt see it until after I had replied with a sample. Thank you all.

+ 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