+ Reply to Thread
Results 1 to 11 of 11

Problem with my VBA array formula

  1. #1
    Forum Contributor
    Join Date
    02-05-2014
    Location
    Bay Area
    MS-Off Ver
    Microsoft 365
    Posts
    166

    Problem with my VBA array formula

    Afternoon - I'm challenged with getting my VBA-embedded formula (an array) to work. It works out side of VBA, which makes me think I'm missing an important VBA rule to formulas. Attached is a sample spreadsheet. The formula I'm trying to embed into VBA is located in column E.

    The formula I'm using for VBA is as follows:

    Please Login or Register  to view this content.
    Thank you in advance for any help!
    Attached Files Attached Files
    Last edited by JBeaucaire; 08-31-2016 at 09:33 PM. Reason: Added missing CODE tags. Please read and follow the Forum Rules, link above in the menu bar. Thanks.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Problem with my VBA array formula

    What happened to the one I have corrected it?

  3. #3
    Forum Contributor
    Join Date
    02-05-2014
    Location
    Bay Area
    MS-Off Ver
    Microsoft 365
    Posts
    166

    Re: Problem with my VBA array formula

    Good question. This is a different formula, and I followed your advice, but this particular formula is not working. Apologies for my semi-redundancy.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Problem with my VBA array formula

    You should have at least acknowledge on the thread.
    Array in VBA can only take a max of 255 characters.

  5. #5
    Forum Contributor
    Join Date
    02-05-2014
    Location
    Bay Area
    MS-Off Ver
    Microsoft 365
    Posts
    166

    Re: Problem with my VBA array formula

    You're right, I should acknowledge that on the thread. My fault.
    Ok, I now understand that there is a 255 character limit on the VBA array formula. I suppose I'll have to determine an alternative approach to my problem.
    Thank you.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Problem with my VBA array formula

    Put the formula in as a Named Formula. Then you should only need to enter the formula name.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Problem with my VBA array formula

    There are round ways by splitting the array in to chunks of max 255 characters (Google it), but once the code becomes massive, it will suffer from speed.

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Problem with my VBA array formula

    1) IMPORTANT, make sure cell E2 is the currently selected cell as you do these steps.
    2) Copy the formula into memory
    3) CTRL-F3 to open the Name Wizard
    4) NEW >
    Name: Uniques
    RefersTo: (paste in the formula as is)
    5) OK.

    6) Change the formula in E2 to simply =Uniques
    (that's entered as a normal formula. All Named Formulas are array-able by default)
    Attached Files Attached Files
    Last edited by JBeaucaire; 08-31-2016 at 03:18 PM.

  9. #9
    Forum Contributor
    Join Date
    02-05-2014
    Location
    Bay Area
    MS-Off Ver
    Microsoft 365
    Posts
    166

    Re: Problem with my VBA array formula

    Wow - thanks for the help, JBeaucaire! The step-by-step instructions were super helpful. Much appreciated. With reference to my VBA code, I'm assuming that reference to the "formula name" would then not need an array reference...??? The name of my formula is "Unique_Components" and it indeed has the array built into it (as you mentioned). However, the VBA translation gets fuzzy for me.

    Please Login or Register  to view this content.
    Sorry for the naive questions. I'm doing my best to learn.
    Last edited by JBeaucaire; 08-31-2016 at 09:31 PM. Reason: Added missing CODE tags. Please read and follow the Forum Rules, link above in the menu bar. Thanks.

  10. #10
    Forum Contributor
    Join Date
    02-05-2014
    Location
    Bay Area
    MS-Off Ver
    Microsoft 365
    Posts
    166

    Re: Problem with my VBA array formula

    I believe I asked my question incorrectly. I'll start over with a new line of thinking. Thanks for the help.

  11. #11
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Problem with my VBA array formula

    Please read the forum rules and abide them regarding CODE tags around your posted code. I've fixed your post above.

    As I noted in post #8 that this is regular formula:
    Please Login or Register  to view this content.

+ 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. [SOLVED] Array formula problem?
    By Jowel in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-12-2013, 05:10 PM
  2. Array formula problem
    By sam747 in forum Excel General
    Replies: 3
    Last Post: 10-24-2012, 10:14 PM
  3. Array formula problem.
    By coolhit in forum Excel General
    Replies: 4
    Last Post: 08-09-2009, 06:11 PM
  4. Problem with Array formula
    By andrewc in forum Excel General
    Replies: 2
    Last Post: 11-26-2008, 11:54 AM
  5. [SOLVED] Array formula problem
    By Constance in forum Excel General
    Replies: 3
    Last Post: 08-22-2006, 01:10 PM
  6. [SOLVED] Array Formula Problem
    By bw in forum Excel General
    Replies: 5
    Last Post: 10-27-2005, 10:05 AM
  7. Array Formula Problem
    By Taboard in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-21-2005, 12:56 PM

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