Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi, I have excel file that has multiple tables in same sheet.
It has some other tables that I do not need, but there is not easy way to remove them since size of the tables can change every week so I cant just remove certain amount of rows from the bottom.
But one thing is consistent that whole area that I do not need is after and including row that has TOTAT STD & TOTAL STD2.
If it is possible some how to to use that to delete rows that have TOTAT STD and rows after that I would apreciate the help.
Thanks
Solved! Go to Solution.
I believe this task can be done easily with a simple VBA script. Attach it to a button for ease of use, if necessary.
The VBA Range.Find method will locate the row that contains TOTAT STD & TOTAL STD2.
Then just delete the rows (or the contents of the rows) below that.
If you want the desired table on a new sheet, then use the Range.Copy method to copy the rows up to and including the found row to the new sheet.
Hi @Justas4478,
Give this a go. Create a new blank query, name it: findFinalRow
Open the advanced editor for findFinalRow, select everything that is there and replace it with this:
(input, match) as logical =>
Comparer.Equals( Comparer.OrdinalIgnoreCase,Text.From(input ?? ""), match)
Go back to the query with the data you brought in from the worksheet, make sure the last step is selected in the Applied Steps pane. Press the fx in front of the formula bar, this will insert a manual step into your query and show the identifier of the previous step from that query.
This is a bit tricky but copy this code and paste it inbetween the equals sign (=) and that identifier.
Table.RemoveLastN(
Table.Skip( PutYourIdentifierHere,
each List.AnyTrue(
List.Transform(
Record.ToList(_),
(x)=> findFinalRow(x, "TOTAT STD"))
)
)
)
Your identifier can now be found after the final closing parenthesis of this expression, select and cut it. Next paste it in place of PutYourIdentifierHere.
I hope this is helpful.
Hi @Justas4478
Your request isn't very clear. and without seeing your file it's hard to know exactly how your data is organised.
If you have a table you don't want, then delete it? Or am I missing some other detail?
As for those celsl that have the heading TOTAT STD, they are not in a table, I don't understand why you can't just delete those too.
Where does Power Query come in?
Please supply your file.
Phil
Proud to be a Super User!
I believe this task can be done easily with a simple VBA script. Attach it to a button for ease of use, if necessary.
The VBA Range.Find method will locate the row that contains TOTAT STD & TOTAL STD2.
Then just delete the rows (or the contents of the rows) below that.
If you want the desired table on a new sheet, then use the Range.Copy method to copy the rows up to and including the found row to the new sheet.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 10 | |
| 9 | |
| 6 | |
| 5 | |
| 3 |