Row sorting problem.Need to place row data into correct columns

TerryChristiansohn

New Member
Joined
Feb 11, 2013
Messages
11
Hello. I only know how to record macro's; nothing else, so I cannot even call myself a newbie. But I need help with data that comes to me all jumbled up. The example below is greatly simplified.

In reality, I need to sort out nearly 600,000 rows of data. Each data row contains 28 column records that need to be sorted within that row. The data is divided into worksheets of up to 25,000 rows each. Functions for this many cells kill my computer's memory, so I would really like to have a macro, or a series of macros to accomplish my task.

1. Each farmer grows certain types of fruit. The farmer's and the farmer's country is in one row; that same row also contains the fruit that the farmer grows.
2. The the types of fruit that farmer grows arrives to me scrambled as per its category.
3. Each fruit has its own category: cherries, berries, citrus, Stone Fruit, apples, melons. Happily, you can tell which category each fruit belongs to, for example, each apple variety is preceded by the string "apples:" in the cell.
4. The fruit needs to be sorted into the correct columns as per the row headers.
5. The fruit needs to stay in the same row, so that we always know which farmer grows what fruit, and which country that fruit has been grown in.
6. The index number, the farmer's name and the country must remain in columns A, B, C.

So this is an example that will, hopefully, clarify my problem.

This is how the data arrives:


Index
GrowerCountrytropicalcherriesberriescitrusStone Fruitapplesmelons
1Georgia FarmsGeorgiacitrus: tangerinetropical: mangomelons: cantaloupeberries: Bilberrystone:Apricotscherries: Rainierapples: gravenstein
2Berries n' MoreUSAberries: Cape Gooseberrycherries: Lapincitrus: tangeloapples: golden delicioustropical: bananastone:Nectarinesmelons: Casaba
3Heathcliff Greenhouses LtdUnited Kingdomtropical: starfruitberries: RiberryPeachescitrus: kumquatapples: fujicherries: Vanmelons: Crenshaw
4Innotec GrowersCanadacherries: Bingcitrus: orangeapples: galatropical: passionfruitmelons: Honeydewberries: Indian Gooseberrystone:White peach
5Best OrganicUSAberries: Riberrycitrus: limecherries: lamberttropical: lichiiplummelons: Juan Canaryapples: granny smith
6Toutes Les FruitsFranceberries: Acaimelons: Orange-flesh Honeydewapples: McIntoshstone:prunetropical: longancherries: Skeenacitrus: grapefruit
7Maccedonia di FruitaItalyapples: pippintropical: pineapplecherries: Sweetheart
citrus: lemonberries: Blueberrymelons: Pepino
8Delicious TropicFijimelons: Persiantropical: coconutberries: Black Berrycitrus: Bergamot orangeapples: pink lady
cherries: Queen Anne
9Small Farmers ClubNew Zealand
cherries: Blackapples: braeburnberries: Raspberrymelons: Santa Claustropical: cherimolacitrus: Cleopatra Mandarin
10Certified Organic Fruit GrowersUSAcherries: Choketropical: Rambutanapples: Honeycrispmelons: Seedless Watermelon
berries: Mulberrycitrus: Ponderosa lemon
11Master GardenersUnited Kingdomtropical: guavamelons: Watermelonberries: Strawberrycherries: Maraschino
apples: Arkansas Blackcitrus: Orangelo
12MastrichtNeatherlandscitrus: Persian limecherries: Morelloberries: Red Mulberry
melons: Yellow-Flesh Watermelon
Tropical: orange papaya
13Herbs de Bon SanteFrancemelons: wintermelon

citrus: Palestine sweet limeberries: Logan Berry

14Belle TropicaleTahitiberries: Lingonberry
cherries: North Star

citrus: Pompia
15Oceana FarmersNew Zealand


citrus: kaffir limecherries: Spanish Cherryberries: Huckleberry
16Mexico FruitasMexico



citrus: Limettacherries: Tietonberries: Goji berry
17Northlights OrganicCanada




berries: Elderberry
18Eastern Seasonal Specialties
apples: Arkansas Blackstone:pruneberries: Cranberry

cherries: tart

<tbody>
</tbody>

This is how I need it to be sorted:

IndexGrowerCountrytropicalcherriesberriescitrusStone Fruitapplesmelons
1Georgia FarmsGeorgiatropical: mangocherries: Rainierberries: Bilberrycitrus: tangerinestone:Apricotsapples: gravensteinmelons: cantaloupe
2Berries n' MoreUSAtropical: bananacherries: Lapinberries: Cape Gooseberrycitrus: tangelostone:Nectarinesapples: golden deliciousmelons: Casaba
3Heathcliff Greenhouses LtdUnited Kingdomtropical: starfruitcherries: Vanberries: Riberrycitrus: kumquatstone:Peachesapples: fujimelons: Crenshaw
4Innotec GrowersCanadatropical: passionfruitcherries: Bingberries: Indian Gooseberrycitrus: orangestone:White peachapples: galamelons: Honeydew
5Best OrganicUSAtropical: lichiicherries: lambertberries: Riberrycitrus: limestone:plumapples: granny smithmelons: Juan Canary
6Toutes Les FruitsFrancetropical: longancherries: Skeenaberries: Acaicitrus: grapefruitstone:pruneapples: McIntoshmelons: Orange-flesh Honeydew
7Maccedonia di FruitaItalytropical: pineapplecherries: Sweetheartberries: Blueberrycitrus: lemon
apples: pippinmelons: Pepino
8Delicious TropicFijitropical: coconutcherries: Queen Anneberries: Black Berrycitrus: Bergamot orange
apples: pink ladymelons: Persian
9Small Farmers ClubNew Zealandtropical: cherimolacherries: Blackberries: Raspberrycitrus: Cleopatra Mandarin
apples: braeburnmelons: Santa Claus
10Certified Organic Fruit GrowersUSAtropical: Rambutancherries: Chokeberries: Mulberrycitrus: Ponderosa lemon
apples: Honeycrispmelons: Seedless Watermelon
11Master GardenersUnited Kingdomtropical: guavacherries: Maraschinoberries: Strawberrycitrus: Orangelo
apples: Arkansas Blackmelons: Watermelon
12MastrichtNeatherlandstropical: orange papayacherries: Morelloberries: Red Mulberrycitrus: Persian lime

melons: Yellow-Flesh Watermelon
13Herbs de Bon SanteFrance


berries: Logan Berrycitrus: Palestine sweet lime

melons: wintermelon
14Belle TropicaleTahiti
cherries: North Starberries: Lingonberrycitrus: Pompia


15Oceana FarmersNew Zealand
cherries: Spanish Cherryberries: Huckleberrycitrus: kaffir lime


16Mexico FruitasMexico
cherries: Tietonberries: Goji berrycitrus: Limetta


17Northlights OrganicCanada

berries: Elderberry



18Eastern Seasonal Specialties

cherries: tartberries: Cranberry
stone:pruneapples: Arkansas Black

<tbody>
</tbody>


<tbody>
</tbody>
Thank you.

 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,216,588
Messages
6,131,589
Members
449,657
Latest member
Timber5

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