Power Query to Get Category Names from Above Row Value

legalhustler

Well-known Member
Joined
Jun 5, 2014
Messages
1,214
Office Version
  1. 365
Platform
  1. Windows
Hello,

I need to transform this step of the query to get the category names (in bold) next to each of its corresponding items. The Table link in the second column for the category is not used in the expected results, it's for the corresponding items. I just need the category names next to each items.

Transform this:

FruitsTable
ApplesTable
OrangesTable
DrinksTable
CokeTable
PepsiTable
SpriteTable
7 UpTable
Dr. PepTable
VegetablesTable
OnionsTable
LettuceTable
MushroomsTable

Expected Result:


FruitsApplesTable
FruitsOrangesTable
DrinksCokeTable
DrinksPepsiTable
DrinksSpriteTable
Drinks7 UpTable
DrinksDr. PepTable
VegetablesOnionsTable
VegetablesLettuceTable
VegetablesMushroomsTable
 
Last edited:

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
I didn't get a chance to edit the table but note the first column all have the word "category" in the first column (i.e. Category Fruits, Category Drinks, Category Vegetables), so whenever the word "category" is found it puts the full category name next to each item (Category Fruits, Category Drinks, Category Vegetables). That should be the trigger to determine how many rows of items each category has.
 
Upvote 0
Add a column, use Text.StartsWith to find all with "Category" and those that don't are null
Fill Down new column
Split the new column to separate Category
Remove Category Column
Move Other Column to first position
Filter out all rows containing Category from original data
 
Upvote 0

Forum statistics

Threads
1,223,693
Messages
6,173,877
Members
452,536
Latest member
Chiz511

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