+ Reply to Thread
Results 1 to 5 of 5

Embedding arrays within formulas

  1. #1
    Registered User
    Join Date
    01-30-2007
    Posts
    8

    Embedding arrays within formulas

    Hi there,

    I have a custom UDF that requires a 2-element array in one of the parameters of the form: {string 1, string 2}.

    If I construct the formula such that the array is a 'hard' copy, i.e. =MyUDF(param1, param2, {"abc", "def"}) then it works perfectly. However, I want to be able to pull the actual string values themselves off cells. This where I've become stuck.

    I've tried the following,

    1. Concatenating { } with the string values such as "{"&string1&","&string2&"}". The problem with this is that the end result is "{"abc", "def"}", so Excel treats the parameter as a string rather than a 2-element array

    2. Concatenating string1,string2 in a cell and then wrapping this up in an ADDRESS and INDIRECT call. So the third parameter become INDIRECT(ADDRESS(ROW(cell),COLUMN(cell))). This didn't work either.

    3. I also tried "forcing" the result to become an array by wrapping the second solution in an INDEX call, so it becomes INDEX(INDIRECT(ADDRESS(ROW(cell),COLUMN(cell))),1,1). This didn't work either.

    Am a bit stuck now and would appreciate any thoughts solutions. My preference would be to achieve this in-sheet without any VBA.

    Thanks.

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Embedding arrays within formulas

    Hi,

    Why do you not simply alter the UDF so that it will accept a range?
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Registered User
    Join Date
    01-30-2007
    Posts
    8

    Re: Embedding arrays within formulas

    Unfortunately, I don't have the ability to modify the UDF. It's part of a closed source add-in (and I have no idea why it was designed this way).

    Is there a way to do this in sheet?

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Embedding arrays within formulas

    It's going to be a bit hit and miss without knowing the declaration of the UDF, but what if you simply pass a 2 cell range as the last argument- e.g. A1:B1- or use INDEX to convert to an array- e.g. INDEX(A1:B1,0,0)

  5. #5
    Registered User
    Join Date
    01-30-2007
    Posts
    8

    Re: Embedding arrays within formulas

    Ha. Shows that the simplest solution is best! A1:B1 worked perfectly! So much for overthinking the problem.

    Thanks again.

+ 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] Defined Name: Arrays and Formulas
    By Zeesh in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-20-2016, 08:29 AM
  2. Excel help with arrays and formulas
    By wolfdemon710 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-31-2015, 09:48 PM
  3. Embedding Excel document in word with formulas exposed
    By caabdul in forum Excel General
    Replies: 1
    Last Post: 08-25-2014, 05:35 AM
  4. [SOLVED] If I have for example 200 formulas and I need to make them all arrays. Help?
    By Zeha90 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-05-2014, 03:49 AM
  5. Can you use arrays within other non array formulas?
    By beesus311 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-04-2013, 12:26 PM
  6. Arrays & array formulas
    By cmcgath in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-06-2009, 07:14 PM
  7. [SOLVED] Relative Referencing Formulas in Arrays
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-22-2005, 08:05 AM

Tags for this Thread

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