+ Reply to Thread
Results 1 to 9 of 9

Spilling a BYCOL/LAMBDA function across rows

  1. #1
    Registered User
    Join Date
    04-14-2014
    Location
    Cape Town, South Africa
    MS-Off Ver
    MS 365 v. 2304 64-bit
    Posts
    3

    Spilling a BYCOL/LAMBDA function across rows

    Hi all,

    See attached a sample workbook of my problem.

    I have a given set of NxK input data. The example sheet has 20 data rows across 10 column variables.

    I am trying to achieve the following: using a single dynamic spilled formula (i.e. no VBA), calculate the sum per column of M randomly chosen rows and output this a total of J times. The final output is thus a J x K matrix of random M-observation sums per column.

    My solution so far is to use a BYCOL/LAMBDA function with RANDARRAY to calculate the random M-sum values but this only spills across columns. I still have to drag this formula down to get a total of J output rows.

    I have also tried to use an IF-statement which checks if an input array is less than or equal to the desired number of output rows. This does spill across the target number of rows but the outputs are all the same because the RANDARRAY function doesn't update between rows and hence we are summing the same M numbers per column each time.

    Any assistance in creating a dynamic formula that updates and spills across rows would be greatly appreciated.

    Regards,
    Emlyn
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,773

    Re: Spilling a BYCOL/LAMBDA function across rows

    Excel 2013 cannot be your Excel version - please update your forum profile. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    04-14-2014
    Location
    Cape Town, South Africa
    MS-Off Ver
    MS 365 v. 2304 64-bit
    Posts
    3

    Re: Spilling a BYCOL/LAMBDA function across rows

    Updated, thanks.

  4. #4
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,921

    Re: Spilling a BYCOL/LAMBDA function across rows

    Try this,

    B25
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by windknife; 06-23-2023 at 06:46 AM.

  5. #5
    Registered User
    Join Date
    04-14-2014
    Location
    Cape Town, South Africa
    MS-Off Ver
    MS 365 v. 2304 64-bit
    Posts
    3

    Re: Spilling a BYCOL/LAMBDA function across rows

    Thanks very much, windknife, much appreciated.

    I've applied in my actual application, where input data dimension is 600x10, simulation numbers range between 1000 to 5000 and the outputs are sums of 30-120 random values. Performance of the auto-spilled version is considerably slower than the manually dragged down version.

    No need to do further work (this is great already) but would you have any ideas to improve calculation speed?

    Thanks again.

  6. #6
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,921

    Re: Spilling a BYCOL/LAMBDA function across rows

    You are welcome, but I don't know how to improve calculation speed.
    Maybe, Gurus of this forum can give you some clues.

  7. #7
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,466

    Re: Spilling a BYCOL/LAMBDA function across rows

    Here is an other formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    This formula differs slightly from the Windknife formula in terms of functionality.
    This formula always adds up pro run all different observations.
    The Windknife formula can also add in 1 run the same observations together.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,921

    Re: Spilling a BYCOL/LAMBDA function across rows

    @Hans, thanks for your teaching.

  9. #9
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,466

    Re: Spilling a BYCOL/LAMBDA function across rows

    @Windknife, its not teaching, its a slightly different approach on my part.
    From the OP's question I can't tell which approach is correct.
    I also learn a lot from your formulas. .

+ 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] take last values from rows, spilling column
    By guillaume0314 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-11-2023, 09:41 AM
  2. [SOLVED] Copy Value of cells of rows into next sheets row without spilling into next cell
    By Ajaxs87 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-31-2022, 08:24 PM
  3. ARCANE: LAMBDA function calling XLM functions
    By hrlngrv in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-19-2022, 07:09 PM
  4. Partial spilling of data by new Filter function
    By paradise2sr in forum Excel General
    Replies: 5
    Last Post: 11-08-2021, 04:56 AM
  5. [SOLVED] LAMBDA iteration
    By Slabu in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-20-2021, 08:39 PM
  6. how to convert a VLOOKUP & INDIRECT formula to a LAMBDA function
    By jrtaylor in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-13-2021, 05:11 PM
  7. Lambda Expressions in Excel VBA
    By Gregor y in forum Tips and Tutorials
    Replies: 4
    Last Post: 10-17-2014, 06:59 PM

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