Layered return values in Excel sheet

SeanyD

New Member
Joined
Oct 7, 2024
Messages
2
Office Version
  1. 2021
Platform
  1. Windows
Hello,
i am looking for a formula to return the values like in the table. The values in column A and B are manually entered and want the return values in D,E,F,G,H to populate automatically. I need to start each column where the previous one ends. I've tried IF(ISBLANK... in columns E,F,G,H but i get a #SPILL error. I want to try to stay away from macros- that is currently beyond me.

Any assistance is greatly appreciated

1728339075142.png
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
How about this?

EXCEL
ABCDEFGH
1TypeCount
2Red Car5Red Car
3Red Van4Red Car
4Blue Car4Red Car
5White Car2Red Car
6White Van7Red Car
7Red Van
8Red Van
9Red Van
10Red Van
11Blue Car
12Blue Car
13Blue Car
14Blue Car
15White Car
16White Car
17White Van
18White Van
19White Van
20White Van
21White Van
22White Van
23White Van
Sheet1
Cell Formulas
RangeFormula
D2:H23D2=IFERROR(DROP(REDUCE("",SEQUENCE(ROWS(A2:A6)),LAMBDA(s,c,HSTACK(s,INDEX(A2:A6,VSTACK(INDEX("",SEQUENCE(ROWS(s),,,0)),SEQUENCE(INDEX(B2:B6,c),,c,0)))))),1,1),"")
Dynamic array formulas.
 
Upvote 0
That is Brilliant. Thank you very much Irobbo314. Exactly what i am looking for
 
Upvote 0
Welcome to the MrExcel board!

I was trying for a shorter way but only succeeded by a few characters. :eek: :biggrin:
Anyway, this is what I came up with.

24 10 08.xlsm
ABCDEFGH
1TypeCount
2Red Car5Red Car
3Red Van4Red Car
4Blue Car4Red Car
5White Car2Red Car
6White Van7Red Car
7Red Van
8Red Van
9Red Van
10Red Van
11Blue Car
12Blue Car
13Blue Car
14Blue Car
15White Car
16White Car
17White Van
18White Van
19White Van
20White Van
21White Van
22White Van
23White Van
Layers
Cell Formulas
RangeFormula
D2:H23D2=LET(n,B2:B6,s,SUM(n),x,VSTACK(0,BYROW(n,LAMBDA(q,SUM(B2:q)))),MAKEARRAY(s,ROWS(n),LAMBDA(r,c,IF(AND(r>INDEX(x,c),r<=INDEX(x,c+1)),INDEX(A2:A6,c),""))))
Dynamic array formulas.
 
Last edited:
Upvote 0
For fun, here is a way to do it with Power Query.

PQ
ABCDEFGH
1TypeCountRed CarRed VanBlue CarWhite CarWhite Van
2Red Car5Red Car
3Red Van4Red Car
4Blue Car4Red Car
5White Car2Red Car
6White Van7Red Car
7Red Van
8Red Van
9Red Van
10Red Van
11Blue Car
12Blue Car
13Blue Car
14Blue Car
15White Car
16White Car
17White Van
18White Van
19White Van
20White Van
21White Van
22White Van
23White Van
Sheet2


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    rSum = List.Generate(()=>[x=0,y=-1],
        each [y]<Table.RowCount(Source)-1,
        each [y = [y]+1,x=[x]+Source[Count]{y}],
        each [x]
    ),
    toTable = Table.FromColumns(Table.ToColumns(Source) & {rSum}),
    Pad = Table.TransformRows(toTable, each List.Repeat({""},[Column3]) & List.Repeat({[Column1]},[Column2])),
    Final = Table.FromColumns(Pad,Source[Type])
in
    Final
 
Upvote 0

Forum statistics

Threads
1,223,879
Messages
6,175,150
Members
452,615
Latest member
bogeys2birdies

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