+ Reply to Thread
Results 1 to 10 of 10

Using an array, written out explicitly in curly braces in a cell, within another formula

  1. #1
    Registered User
    Join Date
    11-06-2019
    Location
    Newcastle, UK
    MS-Off Ver
    365
    Posts
    5

    Using an array, written out explicitly in curly braces in a cell, within another formula

    I have produced an array in one cell (using a TEXTJOIN) that I would like to use in further calculations. The string in that cell can be formatted any way I want - I have formatted it as {1,2,3} - because this is how Excel normally formats arrays.

    However, when I try to pass this to another Excel function it breaks - e.g. if the string {1,2,3} is in cell A1, then: AVERAGE(A1) = #DIV/0!

    If I do this manually and simply write: AVERAGE({1,2,3}) = 2 as it should.

    In other words, Excel is parsing the string {1,2,3} differently when it's hand-written into a formula, and when that string {1,2,3} is explicitly written out in another cell.

    I've also tried embedding the TEXTJOIN within the AVERAGE but that doesn't work either (and I'd rather break the two steps up anyway).

    Any thoughts?
    Attached Files Attached Files
    Last edited by Heff88; 11-06-2019 at 08:12 AM.

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Using an array, written out explicitly in curly braces in a cell, within another formu

    Why dont you just pass the individual values to the AVERAGE function, e.g.
    if you cells you are TEXTJOINing are A1 B1 C1 to produce 1,2,3
    why not just do

    AVERAGE(A1, B1, C1)
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: Using an array, written out explicitly in curly braces in a cell, within another formu

    A1={1,2,3}
    B1=TYPE(A1) => 1 (text)
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  4. #4
    Registered User
    Join Date
    12-03-2012
    Location
    CHENNAI , INDIA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Using an array, written out explicitly in curly braces in a cell, within another formu

    Hi ,

    If you use the Macro 4 Evaluate function , you can get what you want , or so I think.

    Define a named range StringArray , and in the Refers To box enter :

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    where cell G1 contains {1,2,3} entered as a text string.

    Now , in any worksheet cell , enter the formula :
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    and the cell should display 2.

    Narayan

  5. #5
    Registered User
    Join Date
    11-06-2019
    Location
    Newcastle, UK
    MS-Off Ver
    365
    Posts
    5

    Re: Using an array, written out explicitly in curly braces in a cell, within another formu

    Removed - cannot see how to delete post.
    Last edited by Heff88; 11-06-2019 at 08:41 AM.

  6. #6
    Registered User
    Join Date
    11-06-2019
    Location
    Newcastle, UK
    MS-Off Ver
    365
    Posts
    5

    Re: Using an array, written out explicitly in curly braces in a cell, within another formu

    Quote Originally Posted by Special-K View Post
    Why dont you just pass the individual values to the AVERAGE function, e.g.
    if you cells you are TEXTJOINing are A1 B1 C1 to produce 1,2,3
    why not just do

    AVERAGE(A1, B1, C1)
    The MWE was just a conceptualisation of my real issue - and solving it would help me solve my actual problem, which is more complex.

  7. #7
    Registered User
    Join Date
    11-06-2019
    Location
    Newcastle, UK
    MS-Off Ver
    365
    Posts
    5

    Re: Using an array, written out explicitly in curly braces in a cell, within another formu

    Quote Originally Posted by KOKOSEK View Post
    A1={1,2,3}
    B1=TYPE(A1) => 1 (text)
    Is this another way of saying: I can't do what I want?

  8. #8
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,911

    Re: Using an array, written out explicitly in curly braces in a cell, within another formu

    You can, but you need either VBA or XLM, as mentioned.
    Rory

  9. #9
    Registered User
    Join Date
    11-06-2019
    Location
    Newcastle, UK
    MS-Off Ver
    365
    Posts
    5

    Re: Using an array, written out explicitly in curly braces in a cell, within another formu

    Quote Originally Posted by NARAYANK991 View Post
    Hi ,

    If you use the Macro 4 Evaluate function , you can get what you want , or so I think.

    Define a named range StringArray , and in the Refers To box enter :

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    where cell G1 contains {1,2,3} entered as a text string.

    Now , in any worksheet cell , enter the formula :
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    and the cell should display 2.

    Narayan
    Thanks for the answer: is this dependent on using VBA (not sure what "macro 4 array" is)? I would rather avoid this if possible, though aware it may be impossible. It just seems like I'm soooo close and it would render my final spreadsheet much simpler.

  10. #10
    Registered User
    Join Date
    12-03-2012
    Location
    CHENNAI , INDIA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Using an array, written out explicitly in curly braces in a cell, within another formu

    Quote Originally Posted by Heff88 View Post
    Thanks for the answer: is this dependent on using VBA (not sure what "macro 4 array" is)? I would rather avoid this if possible, though aware it may be impossible. It just seems like I'm soooo close and it would render my final spreadsheet much simpler.
    Hi ,

    No , no VBA is involved , though because it is a Macro 4 function , you will have to save the file as a .xlsm or .xlsb file.

    Narayan

+ 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] Sumif with Curly Braces { }
    By marathonrunner in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-29-2018, 06:19 AM
  2. [SOLVED] How to enter array formula with curly brackets into cell
    By Imbizile in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-30-2017, 09:55 AM
  3. How to add array formula that contains curly braces using VBA?
    By Rerock in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-13-2015, 01:17 PM
  4. curly braces
    By Faridwahidi in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-02-2014, 12:48 AM
  5. Array formula that uses last written cell
    By dcguerra in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-01-2013, 03:16 PM
  6. [SOLVED] Can I update Multiple Forumlae With Curly Braces All At Once?
    By stuu3270 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-20-2013, 03:50 PM
  7. What do curly brackets /braces {} do in VBA
    By Huugin in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-17-2012, 04:33 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