Welcome to Windows Help!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Help with converting data in Excel

 
   Windows Help (Home) -> Microsoft Excel RSS
Next:  2003 macro working in 2007 - inserting a jpeg  
Author Message
bawalker

External


Since: Dec 4, 2008
Posts: 2



(Msg. 1) Posted: Thu Dec 04, 2008 8:04 am
Post subject: Help with converting data in Excel
Archived from groups: microsoft>public>excel (more info?)

Hello all,

I have been working with a client of mine for the last few weeks to
get a simple data conversion taken care of. However it has turned out
to be more difficult than I expected. I was provided a *.txt file
that had tons of columns and extra data that wasn't needed. The
client just wanted the names & addresses from the files so they could
use those for mailing labels.

I was able to use Excel 2003 to convert the data into a spread sheet
where the names and addresses shows up. Currently the data looks like
this in Excel:

John Doe
123 Fake Street
New York, NY 12345

Jane Doe
456 Fake Street
New York, NY 12345

Thus each field is in a seperate row making it nice and readable.
However I spoke with the print shop and they said that this is NOT a
compatible format for their software. They want it in excel, but to
have each name & address appear on one field, seperated by a row, then
the next row with another name & address seperated by another row,
etc. They want it to look like the following:

John Doe 123 Fake Street New York, NY 12345

Jane Doe 456 Fake Street New York, NY 12345


However when I used a feature that I can't remember the name of now,
it puts ALL records in to one long row and looks like the following:

John Doe 123 Fake Street New York, NY 12345 Jane Doe 456 Fake
Street New York, NY 12345


After checking with the print shop, this too is incompatible with
their format. Does anyone know or can advise to get this data in the
format that the print shop is seeking???

Brad

 >> Stay informed about: Help with converting data in Excel 
Back to top
Login to vote
google

External


Since: Nov 26, 2008
Posts: 5



(Msg. 2) Posted: Thu Dec 04, 2008 8:23 am
Post subject: Re: Help with converting data in Excel
Archived from groups: per prev. post (more info?)

I started a new sheet and put in a Edit->Fill->Series, Column, Linear,
Step value=4 and got this in column A:

1
5
9
13
17
21
25
29
33
37
.... (and so on ...)

Then in B1:D1, I put in these formulas:

=INDEX([Book1]Sheet1!$A$1:$A$31,$A1,1) <-belongs in B1
=INDEX([Book1]Sheet1!$A$1:$A$31,$A1+1,1) <-belongs in C1
=INDEX([Book1]Sheet1!$A$1:$A$31,$A1+2,1) <-belongs in D1

Where [Book1]Sheet1 is your name and address data. Then I did a Edit-
Fill->Down.

Assuming your names and addresses are three lines each, this should
work for you. Maybe not elegant, but it will work.

 >> Stay informed about: Help with converting data in Excel 
Back to top
Login to vote
bawalker

External


Since: Dec 4, 2008
Posts: 2



(Msg. 3) Posted: Thu Dec 04, 2008 8:30 am
Post subject: Re: Help with converting data in Excel
Archived from groups: per prev. post (more info?)

I'll give that a try, although with names and addresses, they are not
always in 3 rows. Some may have 4 rows or even 5 rows due to an extra
address line or in some cases the initial conversion left a name like:

John Doe
& Mrs Jane Doe
123 Fake Street
Apartment #567
New York, NY 12345

I would say about half the addresses are in a 4 or 5 line format like
that.
 >> Stay informed about: Help with converting data in Excel 
Back to top
Login to vote
google

External


Since: Nov 26, 2008
Posts: 5



(Msg. 4) Posted: Thu Dec 04, 2008 9:10 am
Post subject: Re: Help with converting data in Excel
Archived from groups: per prev. post (more info?)

OK, names and addresses may be 3, 4 or 5 lines. I'm assuming
(according to your originally supplied data model) that there is a
blank line between the records. So instead of an Edit->Fill->Series in
column A, put a 1 in A1 and put this in A2:

=IF(INDEX([Book1]Sheet1!$A$1:$A$32,$A1+3,1)="",A1+4,IF(INDEX([Book1]
Sheet1!$A$1:$A$32,$A1+4,1)="",A1+5,IF(INDEX([Book1]Sheet1!$A$1:$A
$32,$A1+5,1)="",A1+6,A1+7)))

And Edit->Fill->Down a whole bunch.

You've already put those formulas in B1:D1, so now put these into E1
and F1

=IF(INDEX([Book1]Sheet1!$A$1:$A$32,$A1+3,1)<>"",INDEX([Book1]Sheet1!$A
$1:$A$32,$A1+3,1),"") <-belongs in E1
=IF(AND(INDEX([Book1]Sheet1!$A$1:$A$32,$A1+3,1)<>"",INDEX([Book1]
Sheet1!$A$1:$A$32,$A1+4,1)<>""),INDEX([Book1]Sheet1!$A$1:$A
$32,$A1+4,1),"") <-belongs in F1

And do an Edit->Fill->Down a whole bunch.

This solution won't fix things like:

John Doe
& Mrs Jane Doe

....being on two lines, but it *should* compensate and autorepair the
datapull if you make manual corrections as you progress down the
column looking for anomolies.
 >> Stay informed about: Help with converting data in Excel 
Back to top
Login to vote
Pete_UK

External


Since: Dec 4, 2008
Posts: 17



(Msg. 5) Posted: Thu Dec 04, 2008 9:51 am
Post subject: Re: Help with converting data in Excel
Archived from groups: per prev. post (more info?)

You said that you (or your print shop) want the names and addresses
combined into one field, with a blank row between each. If that is the
case, then insert a new blank row at the top of your sheet and insert
a new worksheet. Put "x" in A1 of Sheet2 and in A2 you can put this
formula:

=IF(OR(Sheet1!A1="",Sheet1!A2=""),"x","")

Copy this down as far as you need (i.e. for as many rows as there are
in Sheet1). Then in B2 you can use this formula:

=IF(AND(A2="x",A1="x"),Sheet1!A2&" "&Sheet1!A3&" "Sheet1!A4,"")&IF
(A5="x",""," "&Sheet1!A5)&IF(OR(A5="x",A6="x"),""," "&Sheet1!A6)

Then copy this formula down (select B2 and double-click the fill-
handle, which is the small black square at the bottom right corner of
the cursor). Then you can highlight columns A and B by clicking on the
column identifiers and fix the values by clicking <copy>, then Edit |
Paste Special | Values (check) | OK then <Esc>.

Select column A and then apply Autofilter to the column - choose
Blanks from the filter pull-down. Starting with row 3, highlight all
the rows that are visible after filtering (although they will not
contain anything, but the row identifier will have changed colour) and
Edit | Delete Rows. Then from the filter pull-down in A1 you can
select All.

Finally, delete column A, and you should be left with all your data in
column A on alternate rows.

Hope this helps.

Pete

On Dec 4, 4:30 pm, bawal... DEL wrote:
> I'll give that a try, although with names and addresses, they are not
> always in 3 rows.  Some may have 4 rows or even 5 rows due to an extra
> address line or in some cases the initial conversion left a name like:
>
> John Doe
> & Mrs Jane Doe
> 123 Fake Street
> Apartment #567
> New York, NY  12345
>
> I would say about half the addresses are in a 4 or 5 line format like
> that.
 >> Stay informed about: Help with converting data in Excel 
Back to top
Login to vote
Gord Dibben

External


Since: Oct 17, 2008
Posts: 21



(Msg. 6) Posted: Thu Dec 04, 2008 9:54 am
Post subject: Re: Help with converting data in Excel
Archived from groups: per prev. post (more info?)

Select the column and run this macro.

Public Sub TransposePersonalData()
'ken johnson July 29, 2006
'transpose uneven sets of data........must have a blank row between
Application.ScreenUpdating = False
Dim rngData As Range
Dim iLastRow As Long
Dim i As Long
Dim iDataColumn As Integer
iDataColumn = Selection.Column
iLastRow = Cells(Application.Rows.Count, iDataColumn).End(xlUp).Row
i = Selection.Row - 1
Do While ActiveCell.Row < iLastRow
i = i + 1
Set rngData = Range(ActiveCell, ActiveCell.End(xlDown))
rngData.Copy
Cells(i, iDataColumn + 1).PasteSpecial Transpose:=True
rngData.Cells(rngData.Cells.Count + 2, 1).Activate
Loop
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub

Delete the orinal column after running the macro.


Gord Dibben MS Excel MVP

On Thu, 4 Dec 2008 08:30:07 -0800 (PST), bawalker DEL wrote:

>I'll give that a try, although with names and addresses, they are not
>always in 3 rows. Some may have 4 rows or even 5 rows due to an extra
>address line or in some cases the initial conversion left a name like:
>
>John Doe
>& Mrs Jane Doe
>123 Fake Street
>Apartment #567
>New York, NY 12345
>
>I would say about half the addresses are in a 4 or 5 line format like
>that.
 >> Stay informed about: Help with converting data in Excel 
Back to top
Login to vote
Harlan Grove

External


Since: Dec 4, 2008
Posts: 4



(Msg. 7) Posted: Thu Dec 04, 2008 3:43 pm
Post subject: Re: Help with converting data in Excel
Archived from groups: per prev. post (more info?)

wrote...
....
>I was able to use Excel 2003 to convert the data into a spread sheet
>where the names and addresses shows up.  Currently the data looks like
>this in Excel:
>
>John Doe
>123 Fake Street
>New York, NY  12345
>
>Jane Doe
>456 Fake Street
>New York, NY  12345

So there's a blank cell between each name/address block?

>Thus each field is in a seperate row making it nice and readable.
....
> . . . They want it in excel, but to
>have each name & address appear on one field, seperated by a row, then
>the next row with another name & address seperated by another row,
> . . . They want it to look like the following:
>
>John Doe 123 Fake Street New York, NY 12345
>
>Jane Doe 456 Fake Street New York, NY 12345
....

One 'field'? Do you mean on one _row_? If so, would each line in the
original name/address (so field?) be in a separate column in a single
row, or would the lines from the original name/address be separated
from each other by 2 spaces (or a tab?), so the entire reformatted
name/address would be in a single column in a single row?

If your original data were in multiple rows with blank cells between
name/address blocks and the printer needed different name/address
components (the separate lines/fields? in your original name/address
blocks) in separate columns, you could name your entire original data
range SRC and use formulas of the form (in a new worksheet)

A1:
=T(SRC)

B1:
=IF(A1<>"",T(INDEX(SRC,COUNTIF($A1:A1,"?*")+1)),"")

Fill B1 right into C1:E1.

A2:
=IF(AND(A1="",COUNTIF($A$1:$E1,"?*")<COUNTA(SRC)),
T(INDEX(SRC,COUNTIF($A$1:$E1,"?*")+INT((ROWS($A$1:$A2)+1)/2))),"")

B2:
=IF(A2<>"",T(INDEX(SRC,COUNTIF($A$1:$E1,"?*")+COUNTIF($A2:A2,"?*")
+INT((ROWS($A$1:$A2)+1)/2))),"")

Fill B2 right into C2:E2. Then select A2:E2 and fill down as far as
needed.

There are much, much better tools to do this, especially scripting
languages. Excel is a rather poor text processing tool.
 >> Stay informed about: Help with converting data in Excel 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
How to cluster data with Excel - Dear all, excuse me for this maybe "too simple" question.. I am trying to find a way to "cluster" simple data on an excel sheet Example: Variable a Variable b Variable c Case 1 1 0 ...

BUG in Excel 2007 - Plot charts w/data labels - To duplicate this bug, create a chart with two lines with an x-axis that contains consecutive dates. Then, add a plot chart series (again with date x-axis) and add data labels to it. IMPORTANT: Then, change the plot chart to plot using the primary axis...

Excel 2003 toolbars in Excel 2007 - I have used Excel 2003 for years and have made a rather heavy customization by defining new toolbars with buttons calling VBA. Unfortunately, with Excel 2007 toolbars no longer exist! Gates and his gang of developers have decided that we all have to..

Unable to open excel 2007 file in excel 2002 despite havin.. - Hi I have installed office compatibility pack for office 2007. However, every time I try to open an xlsx file, I get unrecognized format error in Excel 2002. I can open docx without an issue. It appears to be that the problem is related specifically....

converting "text" numbers to numbers - I have been using the technique of multiplying cells that have number entries that behave like text entries by the value of 1 to convert them to numbers. However, some mixed cell entries, convert strangely. For example the entry "6 A" (wit...
   Windows Help (Home) -> Microsoft Excel All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]