+ Reply to Thread
Results 1 to 8 of 8

Evaluating single datum arrays

  1. #1
    Registered User
    Join Date
    10-11-2012
    Location
    Cornwall, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Evaluating single datum arrays

    Hi,

    I have several array formulas that include non-array calculated arguments in some functions. This results in Excel treating these arguments as arrays of only one datum (e.g. '{2}'). These arguments are then evaluated as errors. I need a way of removing the braces, so that, for example, turning '{2}' to '2'. Any ideas? I realise it's probably dead simple.

    Thanks.
    Last edited by menim; 01-01-2014 at 08:30 AM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Evaluating single datum arrays

    Hi and welcome to the forum

    Hard to say, without seeing a sample of what you are working with?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    10-11-2012
    Location
    Cornwall, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Evaluating single datum arrays

    Here's a simplified mock-up.

    I don't actually know whether the arrays are the problem, but it's my best guess.

    Thanks.
    Attached Files Attached Files

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Evaluating single datum arrays

    It's difficult for me to test entirely because I don't have MCONCAT function available........but, yes, your problem is caused by COLUMN function which returns an "array" like {2} rather than just 2 - sometimes that isn't a problem but in some functions or circumstances {2} can't be processed.

    One option is to wrap every COLUMN function in another function like MAX or SUM - that will convert the array to a "scalar".....but I think you can use a simpler approach anyway, one that avoids COLUMN functions altogether - try this formula

    =SUBSTITUTE(MCONCAT(IF(INDEX(Table1[[English]:[German]],MATCH(H2,Table1[Name:],0),0)>0,", "&Table1[[#Headers],[English]:[German]],"")),", ","",1)

    confirmed with CTRL+SHIFT+ENTER

    or possibly even simpler like this

    =SUBSTITUTE(MCONCAT(IF(INDEX(Table1,MATCH(H2,Table1[Name:],0),0)=1,", "&Table1[#Headers],"")),", ","",1)

    In that version checking for exactly 1 rather than >0
    Last edited by daddylonglegs; 12-31-2013 at 02:46 PM.
    Audere est facere

  5. #5
    Registered User
    Join Date
    10-11-2012
    Location
    Cornwall, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Evaluating single datum arrays

    Thanks for the SUM idea - that worked a treat. I don't think either simplification would work, as the headers to be concatenated are 'all those between...'.

    I also had to add "" to the IF FALSE in order to stop Excel concatenating "FALSE". The issue is that MCONCAT takes "" as a term to be concatenated with my ", " separator (see attached). Any way around this?
    Attached Files Attached Files

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Evaluating single datum arrays

    If you want to get rid of unnecessary commas you can do as I did in my suggested formulas

    As part of the IF function you concatenate ", " to the front of each value, you don't use MCONCAT to include any separators......and then SUBSTITUTE removes the unnecessary first ", ".....like this.....

    =SUBSTITUTE(MCONCAT(IF(OFFSET(Table1[[#Headers],[Name:]],MATCH($H$2,Table1[Name:]),SUM(COLUMN(Table1[[#Headers],[DoB:]])),1,SUM(COLUMN(Table1[[#Headers],[Stop]])-COLUMN(Table1[[#Headers],[DoB:]]))-1)>0,", "&OFFSET(Table1[[#Headers],[Name:]],0,SUM(COLUMN(Table1[[#Headers],[DoB:]])),1,SUM(COLUMN(Table1[[#Headers],[Stop]]))-SUM(COLUMN(Table1[[#Headers],[DoB:]]))-1),"")),", ","")

    I still think the shortened version will work, where I used Table1[[English]:[German]] that will give you all columns between English and German - it certainly worked OK on the data you showed here........
    Last edited by daddylonglegs; 12-31-2013 at 06:52 PM.

  7. #7
    Registered User
    Join Date
    10-11-2012
    Location
    Cornwall, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Evaluating single datum arrays

    Great. Thanks! All working perfectly now.

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Evaluating single datum arrays

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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. Evaluating Arrays
    By ericwinn in forum Excel General
    Replies: 2
    Last Post: 10-29-2011, 12:41 AM
  2. evaluating one of two items in a single cell
    By mrw111 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-06-2010, 10:08 AM
  3. Defining a datum for a stacked bar chart
    By Christian411 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 12-04-2008, 07:21 AM
  4. Creating a single vertical array from multiple column arrays
    By Bryan in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-10-2005, 03:15 PM
  5. Replies: 3
    Last Post: 03-20-2005, 11:06 AM

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