PHP to Excel to Access - Merged cell problem

Mousewrites

New Member
Joined
Jul 13, 2004
Messages
16
Hello,

I'm trying to make an acess database from the search results from the BPAL website (perfume). Each listing has the perfume group, name, discription, scent family (floral, woody, spicy, ect), and a link to buy two sizes of bottels OR lists it as discontuned.

I copied the results of a search on the site into excel. Here's a portion of the excel spredsheet:
Book2
ABCDEF
1AREANAMEDESCRIPTIONSCENTFAMILIES
2ArsDraconisDragon'sBloodDESCRIPTIONFruitybuy5mlbuy10ml
3Green/Leafy/Herbal
4ArsDraconisDragon'sBloodDESCRIPTIONResin/Incense/Smokybuy5mlbuy10ml
5ArsDraconisDragon'sEyeDESCRIPTIONFloralbuy5mlbuy10ml
6Resin/Incense/Smoky
7ArsDraconisDragon'sHeartDESCRIPTIONFloralbuy5mlbuy10ml
8Fruity
9Resin/Incense/Smoky
10ArsDraconisDragon'sMilkDESCRIPTIONFruitybuy5mlbuy10ml
11Oriental/Gourmand/Spicy
12Resin/Incense/Smoky
13ArsDraconisDragon'sTearsDESCRIPTIONGreen/Leafy/Herbalbuy5mlbuy10ml
14Ozone/Marine/Fresh
15Resin/Incense/Smoky
16AstrologicalOilsAquariusDESCRIPTIONDiscontinued
17AstrologicalOilsAriesMarch21-April19Oriental/Gourmand/SpicyDiscontinued
18DESCRIPTION
19AstrologicalOilsCancerJune21-July22FruityDiscontinued
20DESCRIPTION
Sheet1


Then I imported the spreadsheet into Access, letting it make the fields.

See my problem? Where there was more than one 'scent family,' access only took the first one. The others became their own entry, blank except for the scent family field.

So for Dragon's Blood, (ID 1) it lists the scent family as Fruity. Then there is a blank record (ID 2) that has it's scent family listed as Green / Leafy / Herbal.

I added check boxes (yes/no) for each of the possible scent families to the table, but it would take a very long time to go through by hand and switch them over.

Does anybody have any ideas how I can either write a query to do this, or a different way to import the information?

Link to the Access file: http://home.earthlink.net/~thehivemind/BPAL.mdb[/code]
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Looks like you have a one-to-many problem here, which Excel doesn't handle very well. You'll need to do the following:
1. Build a unique list of Area + Name (best to use Advanced Filter for this)
2. Give each item in this list an ID number
3. Using lookups, build separate tables containing ID, Description; ID, Scent Families; ID, Stock Sizes
Import these tables into Access. Let Access add a separate primary key for the first table -- that way, any others that you add manually will automatically get ID's. Once imported, relate the tables via the ID value and build queries to check that the assembled version makes sense.

If you need help on this, post back

Denis
 
Upvote 0
Hmmm, that makes sense, I think.

I'm not quite sure what you mean by using advanced filter to get the area and name fields out. Couldn't I just select them? (or am I missing something really fundamentally important here? It's been known to happen...)

So I break those off into their own excel spreadsheet, and then give them IDs? In excel, or should I let access give them IDs?

My question there is then do I have to hand assign the IDs to the description, scent family, and stock sizes?

Sorry to be less than competent; I'm still learning access, and databases in general.

Thanks for your help!
 
Upvote 0
I guess there are a couple of ways to proceed. One will do the job properly, but take quite a bit of description. Then there's the quick and dirty method, which I will describe now. In essence, this involves filling all the blanks in the Excel table before importing, and then using Access' Table Analyzer to split the data up for you. The Analyzer gives you less control but gets you going quickly.
First, fill the blanks in the table.
This is tedious without code, so here's a macro.
Code:
Sub FillTheBlanks()

    Range("A1").CurrentRegion.Select
    Selection.SpecialCells(xlCellTypeBlanks).Select
    Selection.FormulaR1C1 = "=R[-1]C"
    Range("A1").CurrentRegion.Select
    Selection = Selection.Value
End Sub
In your Excel file, press Alt + F11 to enter the macro editing environment. Insert | Module, then copy and paste the code above into this module.
Go back to Excel, press F8 to bring up the dialog, make sure FillTheBlanks is selected, and press ENTER. Your table should no longer have any blank cells; the blanks will be filled with the "parent" value above then in the column.
Now, import into Access as before
Do this in a blank database so you can start from scratch. Name the imported table Table1, but DON'T create a primary key
Now run the Table Analyzer
Tools | Analyze | Table will launch a wizard. Follow the wizard, renaming new tables and fields as prompted. Once it finishes running you'll have a database set up with relationships. You should be able to use this for searching etc.

If you don't like the result of the wizard, post back and I can take you through creating your own database from the imported table.

Denis
 
Upvote 0

Forum statistics

Threads
1,221,848
Messages
6,162,419
Members
451,765
Latest member
craigvan888

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