Forum Discussion
Insert a group of rows (copy) from one tab into another tab based on a cell value
Dear experts,
Please put me out of my misery. After a long process of pulling data from a PDF to put into Excel, I now have 2 tabs of data. It was beautiful and served the purposes initially explained. Since then, more requirements have surfaced and I also need to track status.
I'm providing an simplified example to protect the sensitivity of the real data.
Offices tab
Office | Asset Set |
1 | 1 |
2 | 2 |
3 | 1 |
Assets tab
Asset Set | Asset | Description | Delivery Date | Delivered? |
1 | L-shaped Desk | Ikea 1003 | ||
1 | Ergo Chair | Wayfair 40 | ||
1 | Bookshelf | Ikea 502 | ||
2 | Basic Desk | Walmart 20-7474 | ||
2 | Basic Chair | Walmart 20-9348 | ||
2 | Bookshelf | Ikea 502 |
Data is in a single Excel worksheet. One tab contains all the offices in a building. The second tab contains the breakdown of items that belong in that office. I made sure to have the Asset number relationship in the tabs because I'm pulling this data into a different format for use elsewhere.
(Side note: the items that make up an asset set could exist in another asset set.; see Bookshelf)
I add 2 new columns in the Assets tab for Delivery info since I need to know whether the item was delivered to the office, for all items, for all offices.
I can do the Index Match formula to find the Asset Set value in the Offices tab but I couldn't find any way to select all the rows in the Asset tab, Copy, and Insert Copied Rows under that referenced row on the Offices tab. 😕 I don't know VBA or Macros except to copy and tweak.
I have 1000 rows in the Assets tab and 300 rows in the Offices tab. I really really don't want to do this manually if I can avoid it. I'll need to do this as more office buildings get updated equipment.
In the meantime, I will start this process manually;
- Create a new tab
- Copy Office row, paste into new sheet
- Copy group of rows from Asset tab
- paste under office row (starting at column B to preserve the column heading detail)
- Rinse and repeat.
I hope someone has an amazing solution. Thanks in advance for your brain.
=DROP(IFNA(REDUCE("",SEQUENCE(ROWS(A3:A5)),LAMBDA(u,v,VSTACK(u,"Office "&INDEX(A3:A5,v),HSTACK("Asset Set","Asset","Description","Delivery Date","Delivered?"),FILTER(A9:E14,A9:A14=INDEX(B3:B5,v))))),""),1)
With Office 365 or Excel for the web you can apply this formula.
- OliverScheurichGold Contributor
=DROP(IFNA(REDUCE("",SEQUENCE(ROWS(A3:A5)),LAMBDA(u,v,VSTACK(u,"Office "&INDEX(A3:A5,v),HSTACK("Asset Set","Asset","Description","Delivery Date","Delivered?"),FILTER(A9:E14,A9:A14=INDEX(B3:B5,v))))),""),1)
With Office 365 or Excel for the web you can apply this formula.
- BonitaCopper ContributorThank you so much!! I would have never figured it out.
- peiyezhuBronze Contributor
sql:
select * from Sheet5 limit 20;
select * from Sheet4 limit 20;
create temp table aa as
select * from Sheet4 join Sheet5 using(`Asset Set`);
select Office,group_concat(Asset Set||Asset||Description) 子表 from aa group by Office; - rexs33970Copper ContributorThanks it very helpful.