Spreading a value across an array

narnian_uk

New Member
Joined
Jul 28, 2021
Messages
21
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I have an array which looks like this (but any of the elements could contain any positive value or zero, and there could be fewer or more rows; this is just an example):

1683729249458.png


I'm trying to write a formula which spreads the values in the above array evenly across three columns so that it ends up looking like this (I'll only show the final seven columns in order to make the screenshot large enough to be visible):

1683729372927.png


I had initially assumed that I could perhaps use something like =IF(array>0, CHOOSE({1,2,3},array/3,array/3,array/3),) - but that just produces an #N/A (I assume it's the equivalent of some kind of spill error).

I'd very much appreciate any thoughts you might have (including 'can't be done, stop wasting your time')!
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Will you always have padding on either side? That is to say, are you ever going to have a situation where the positive value is on the edge of the range? Or, will there be enough zeros on either side to be able to spread the value to the left and to the right of the positive value?
 
Upvote 0
Will you always have padding on either side? That is to say, are you ever going to have a situation where the positive value is on the edge of the range? Or, will there be enough zeros on either side to be able to spread the value to the left and to the right of the positive value?
Good question. The value will always need to be spread to the right, so there'll never need to be padding on the left. Let's assume that there'll always be enough padding to the right - I think that's likely anyway.
 
Upvote 0
Maybe this...

narnian
ABCDEFGH
100065.80000
200065.80000
3004700000
4
50021.9333321.9333321.93333000
60021.9333321.9333321.93333000
7015.6666715.6666715.666670000
Sheet8
Cell Formulas
RangeFormula
A5:H7A5=LET(tc,TOCOL(A1:H3),rc,ROWS(tc),sp,EXPAND(MAP(SEQUENCE(rc-2),LAMBDA(x,SUM(INDEX(tc,SEQUENCE(3,,x)))/3)),rc,,0),rt,INDEX(sp,MOD(SEQUENCE(ROWS(sp),,0)-1,rc)+1),WRAPROWS(rt,COLUMNS(A1:H3)))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,265
Members
452,627
Latest member
KitkatToby

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top