Import from crazy Excel file

indyaries

Registered User.
Local time
Today, 22:45
Joined
Apr 22, 2002
Messages
102
Greetings,

I searched on IMPORT, but didn't see anything like the problem I have.

I have a large Excel file formatted thus;
COLUMN A COLUMN B COLUMN C
1 Full Name
2 Full address
3 City State Zip
4 Phone SSN Sex

Alas, as you can see, the first four rows contain information on one person, then Column B contains just their SSN on Row 4, and so forth.

Row 5 begins the cycle again. This goes on for 160 people.

Is there a way to get the employee information contained in Column A in a 'nomalized' format, such as Full Name in Col A, Full Address in Col B, and so on?

Unfortunately, it's illegal here to whack the person who provided this data to me.

Thanks in advance !!
 
No response in 12 hours ??

Perhaps I should have posted this in the Queries forum.

I simply need to get the employee information in tabular format, rather than the columnar that it's in now.
 
Run something like this in Excel...
(You could do this from Access)
Code:
Private Sub CommandButton1_Click()
    Dim cel As Range
    Set cel = ActiveSheet.Range("a2")
    
    Do While Trim(cel.Value) & "" <> ""
        cel.Offset(0, 1) = cel.Offset(1, 0)
        cel.Offset(0, 2) = cel.Offset(2, 0)
        cel.Offset(0, 3) = cel.Offset(3, 0)
        cel.Offset(0, 4) = cel.Offset(3, 1)
        cel.Offset(0, 5) = cel.Offset(3, 2)
        
        Rows(cel.Offset(1, 0).Row).Delete
        Rows(cel.Offset(1, 0).Row).Delete
        Rows(cel.Offset(1, 0).Row).Delete
        
        Set cel = cel.Offset(1, 0)
    Loop
    
End Sub
I forgot how to delete 3 rows at once...you can work on it if you want. (I'm a bit hungover 2 b doing this kinda stuff.)
 
Thanks, Sergeant, for the reply.

I tinkered with your reply for a bit, but most of my time has been consumed with dealing with the hail storm we had here in Indiana.

Alas, I couldn't get your solution to work for me. However, I found another solution late last night...

TRANSFORM First(tblExcelImport.A) AS FirstOfA
SELECT Max(tblExcelImport.ID) AS MaxOfID
FROM tblExcelImport
GROUP BY ([ID]-1)\4
PIVOT "Col" & ([ID]-1) Mod 4;

I can then create a query based on my crosstab and import table.

SELECT ID, Col0, Col1, Col2, Col3, tblExcelImport.B, tblExcelImport.C
FROM qxtbExcelImport INNER JOIN tblExcelImport ON qxtbExcelImport.MaxOfID = tblExcelImport.ID;

This worked very well. Thanks for trying, though !! I've been hungover a time or two :D
 

Users who are viewing this thread

Back
Top Bottom