+ Reply to Thread
Results 1 to 7 of 7

Create an Array from Excel formula

  1. #1
    Forum Contributor
    Join Date
    07-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    476

    Create an Array from Excel formula

    Hi,

    Does anyone know how to create an array from a formula without creating a UDF? I am trying this to no avail?

    Please Login or Register  to view this content.
    **Also tried putting this in Name Manager and using EVALUATE, strangely getting value error.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Create an Array from Excel formula

    It would help if we had a clue what you're trying to do and what ="{"&Col.Header&"Paid"&"}" is supposed to mean.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Valued Forum Contributor
    Join Date
    10-05-2014
    Location
    Regina, SK Canada
    MS-Off Ver
    Excel for Mac 11
    Posts
    330

    Re: Create an Array from Excel formula

    Do you mean to create an array formula in a cell using VBA? If so, use the FormulaArray property.

    Here's an example:
    Please Login or Register  to view this content.
    Curly brackets are not needed in the VBA code but will appear in the generated formula.
    Last edited by StuCram; 09-09-2015 at 10:58 PM.
    If this has been helpful, please click on the star at the left.

  4. #4
    Valued Forum Contributor
    Join Date
    10-05-2014
    Location
    Regina, SK Canada
    MS-Off Ver
    Excel for Mac 11
    Posts
    330

    Re: Create an Array from Excel formula

    An another issue, the ampersand normally should have a space before it when your intent is to concatenate values.
    (When an & appears at the end of a variable, it signifies a 'Long' type variable.

    Plus, don't forget to include a space (or hyphen, etc.) to improve readability in the generated code

    ex
    Please Login or Register  to view this content.

    But as shg suggested, we really need to know much more about your program's intent before answering further.
    Please describe in detail what you are trying, including the data both before and after the macro; If possible, attach a sample workbook with your (desensitized) data.
    Last edited by StuCram; 09-09-2015 at 11:07 PM.

  5. #5
    Forum Contributor
    Join Date
    07-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    476

    Re: Create an Array from Excel formula

    My apologies, was trying to write an array whoesale using a formula, where Col.Header was a named range. So for instance, where Col.Header gives me the header dynamically, I was hoping to create an array with Col.Header and an appendage and Col.Header by itself.

    It doesn't look like there's a way to do it in Excel UI natively, so doesn't look like there's a VBA solution to wrting it into the Name manager.

    Sorry for my poor querry. Thanks for your time

  6. #6
    Valued Forum Contributor
    Join Date
    10-05-2014
    Location
    Regina, SK Canada
    MS-Off Ver
    Excel for Mac 11
    Posts
    330

    Re: Create an Array from Excel formula

    Do you want to defined a named range using VBA? That can be done. . .
    Try recording an example to see the generated code; then adapt as needed.
    Note that RC references in the macro recorder.

    Here's what I got . . .
    Please Login or Register  to view this content.
    Notes:
    1. The Range(. . .).Select instruction is not needed.

    2. The RefersToR1C1 parameter may be replaced by the RefersTo parameter with a regular range indication.
    example:
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    07-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    476

    Re: Create an Array from Excel formula

    thanks stucram, but no, I was trying to see if I can "write" an array of constants using a formula similar to VBA's Array function. Doesn't look like it though

+ 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] How to create a array formula to retrieve data?
    By mso3 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-03-2015, 09:17 AM
  2. Replies: 2
    Last Post: 01-25-2012, 12:27 PM
  3. Shortest formula to create a special array
    By kayard in forum Excel General
    Replies: 6
    Last Post: 02-07-2011, 01:01 PM
  4. How to create an array formula using VB
    By SCFM in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-05-2010, 04:11 PM
  5. Create array and formula based on 2 different sheets
    By beeawwb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-30-2008, 02:53 AM
  6. I need to create an array formula combined with a countif
    By Rochelle B in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-25-2005, 01:05 AM
  7. [SOLVED] How can I create an array formula for non-sequential cells
    By Sue in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-21-2005, 01:59 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