Data Merge if data comes in different cell

harinsh

Active Member
Joined
Feb 7, 2012
Messages
273
Hi Team,

Looking for one function or macro in order to identify the blank cell (in sl.no column) if yes then it should merge the two given cells.

I have data which is extract from PDF and in A1 column I have serial number the challenge here some cells divided in two different cells (down cell) for example if cell A10 contains serial number 10 and B10 contains text and some portion of B10 text will comes in B11 however serial number will not come.

I would like to merge the below continuation cell to above one. Here only condition is serial number for continuation cell does not has serial number.

example:
A1 B1
1 Computer Hardware &
Software
2 Microsoft Windows &
Microsoft MS Office

output:
A1 B1
1 Computer Hardware & Software
2 Microsoft Windows & Microsoft MS Office

Please not that I have rows around 800 to 1500 and most of the cells extracts in single cell. I want to make single cells those were not extracted properly.

Kindly let me know if you need further clarification.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Code:
Sub a()
r = 1
Do While Cells(r, 1) <> ""
  Cells(r, 1).Value = Cells(r, 1).Value & Cells(r + 1, 1).Value
  Rows(r + 1).Delete
  r = r + 1
Loop
End Sub
 
Upvote 0
Thanks for your code, I'm really not understanding my am I deleting the row here....I want to merge the cells (down cell) and also this code changing the my Serial number which is not my requirement.
 
Upvote 0
need a sample file with data and desired result, try this
Code:
Sub a()
r = 1
Do While Cells(r, 1) <> ""
  If Val(Left(Cells(r + 1, 1).Value, 1)) = 0 Then
    Cells(r, 1).Value = Cells(r, 1).Value & Cells(r + 1, 1).Value
    Rows(r + 1).Delete
  End If
    r = r + 1
Loop
End Sub
 
Upvote 0
Thank you very much ...it is working fine now....just one thing need to add ...I would like to merge one blank space along with data because data getting paste next to text without blank space...How can I do it?
 
Upvote 0
Code:
Sub a()
r = 1
Do While Cells(r, 1) <> ""
  If Val(Left(Cells(r + 1, 1).Value, 1)) = 0 Then
    Cells(r, 1).Value = Cells(r, 1).Value [COLOR=#ff0000]& " " &[/COLOR] Cells(r + 1, 1).Value
    Rows(r + 1).Delete
  End If
    r = r + 1
Loop
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,922
Messages
6,122,281
Members
449,075
Latest member
staticfluids

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