Sorting text within a excel cell dynamically via vbscript

jeggosh

New Member
Joined
Feb 19, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I have a spreadsheet that scrapes data from my board game library on boardgamegeek.com. I found it on a forum there and have been adjusting it to my preferences

I am trying to sort the "mechanics" and "Categories" columns dynamically. There is no consistent order to how they are listed and I'd prefer to have them consistent. types of mechanics are separated by " |" for example, it populates the "Mechanics" with:
Animals |Card Game |Comic Book / Strip |Humor |Expansion for Base-game
Comic Book / Strip |Humor |Animals |Card Game Mature / Adult
Animals |Card Game |Comic Book / Strip |Humor |Party Game
Animals |Card Game |Comic Book / Strip |Expansion for Base-game |Humor
Expansion for Base-game |Horror

so the values are:
Animals
Card Game
Comic Book / Strip
Humor
Expansion for Base-game
Card Game Mature / Adult
Party Game
Horror

What I'd like to do is whenever I update the sheet, they automatically are ordered by a custom matrix. For instance:
Party Game
Card Game
Card Game Mature / Adult
Humor
Horror
Animals
Comic Book / Strip
Expansion for Base-game

and then populates the cell as such:
Card Game |Humor |Animals |Comic Book / Strip |Expansion for Base-game
Card Game Mature / Adult |Humor |Animals |Comic Book / Strip
Party Game |Card Game |Humor |Animals |Comic Book / Strip
Card Game |Humor |Animals |Comic Book / Strip |Expansion for Base-game
Horror |Expansion for Base-game
Thanks in advance!
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
an image for reference
 

Attachments

  • 1708361726102.png
    1708361726102.png
    52.4 KB · Views: 7
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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