PDF to excel conversion issue

bristolrob

New Member
Joined
Apr 23, 2018
Messages
34
I am converting a pdf to excel and encountering an issue where the conversion inserts carriage returns into a new cell below its dot entry.
Is there a way of getting the data from the carriage return back into its correct cell entry in the row above.
The conversion is on the left and what i am after is on the right

[TABLE="width: 619"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]engine[/TD]
[TD] [/TD]
[TD]engine[/TD]
[/TR]
[TR]
[TD].engine block[/TD]
[TD] [/TD]
[TD].engine block[/TD]
[/TR]
[TR]
[TD]..exhaust manifold[/TD]
[TD] [/TD]
[TD]..exhaust manifold 3/4inch steel[/TD]
[/TR]
[TR]
[TD]3/4inch steel[/TD]
[TD] [/TD]
[TD]..carburettor[/TD]
[/TR]
[TR]
[TD]..carburettor[/TD]
[TD] [/TD]
[TD]..cooling system steel tubing[/TD]
[/TR]
[TR]
[TD]..cooling system[/TD]
[TD] [/TD]
[TD]..clutch plate[/TD]
[/TR]
[TR]
[TD]steel tubing[/TD]
[TD] [/TD]
[TD]…clutch housing solid steel plate[/TD]
[/TR]
[TR]
[TD]..clutch plate[/TD]
[TD] [/TD]
[TD]..manifold bolts 3/4inch bolts[/TD]
[/TR]
[TR]
[TD]…clutch housing[/TD]
[TD] [/TD]
[TD]..manifold plate[/TD]
[/TR]
[TR]
[TD]solid steel plate[/TD]
[TD] [/TD]
[TD]..manifold cover aluminium cover plate[/TD]
[/TR]
[TR]
[TD]..manifold bolts[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]3/4inch bolts[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]..manifold plate[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]..manifold cover[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]aluminium cover plate[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
This will do what you want but assumes that there is only ever going to be one carriage return, and the first "engine" in the list is a mistake in the sample as it has no dot entry to attach it to above?

Code:
Sub FixPDF()
LastRow = Range("A" & Rows.Count).End(xlUp).Row
y = 1

For x = 1 To LastRow
    If Left(Cells(x, "A").Value, 1) = "." Then
        Cells(y, "B").Value = Cells(x, "A").Value
        y = y + 1
    Else
        y = y - 1
        Cells(y, "B").Value = Cells(x - 1, "A").Value & " " & Cells(x, "A").Value
        y = y + 1
    End If
Next x

End Sub

It looks in Column A and puts the corrected list in Column B.
 
Upvote 0
Jazz many thanks for the solution, I have tried it out and it initially looks like it works a treat.I will try it on a full spreadsheet when i am not WFH lol.N.B. the engine in the top row does not have a dot entry as it is the highest level 0, then each child has a dot entry below the parent.Many many thanks for the solution, this one has been doing my head in for a while
 
Upvote 0
No bother - Glad to help, I have to deal with mangled data all the time so am quite used to piecing things together unfortunately :-/

Can you work with this to get what you need bearing in mind the Level 0 thing?
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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