Check a cell in one column and concatenate the rows in another column and ignore some cells.

imran1059

Board Regular
Joined
Sep 28, 2014
Messages
112
I need some formula or vba code to get the desired output. Formula should check column D if a cell in column D starts with "0" then concatenate all rows in column L (with spaces) until another cell in column D that starts with "0". Red highlighted cells are the garbage that are produced by the report we need to ignore them they will come at the start of every page and I have thousands of pages.

Given Column
Given Column
Desired Output
Column DColumn LColumn M
0000000Aug salary of Eid A.Al-Aug salary of Eid A.Al- Qahtani
Qahtani
0589466SEP SALARY OF A.yunusSEP SALARY OF A.yunus MOHD NOOR
MOHD NOOR
0874896SEPT SALARY OF EID.A.AL-SEPT SALARY OF EID.A.AL- Harbi
Harbi
0000000SALARY OF MAHBOUB AL-SALARY OF MAHBOUB AL- Uddin
Uddin
0158933INTERNET ACCESS.INTERNET ACCESS.
0000000INTERNET LAN SERVICE.INTERNET LAN SERVICE.
0000000PETTY CASH FUND.PETTY CASH FUND.
0000000MOBILE TEL. FEES EID ALMOBILE TEL. FEES EID AL Dosairi
Dosairi
0000000MERDIAN NORSTARMERDIAN NORSTAR TEL.SYSTEM P15896 & P 18976 for transfer to B Star
TEL.SYSTEM P15896 & P
18976 for transfer to B
Star
0666492HP PRINTERS COMPAQHP PRINTERS COMPAQ PC.WINDOWS
PC.WINDOWS
te: 04-FEB-2018 11:38
ge: 3

Summaized Description
-------------------------
07798666Settlement ClaimsSettlement Claims of john bros
of john bros

<colgroup><col><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
test the following codes on a copy of your workbook
Code:
Sub Imran()
Dim a As Integer, b As Integer
Dim join As String
a = Cells(Rows.Count, 4).End(xlUp).Row
For b = 1 To a
    If InStr(1, Cells(b, 4), "0") > 0 Then
    join = ""
        If Cells(b, 12).Font.ColorIndex <> 3 Then
        join = join & "  " & Cells(b, 12)
        Cells(b, 13) = join
        Else
        join = join & "  " & Cells(b, 12)
        Cells(b, 13) = join
        End If
    End If
Next b
MsgBox "complete"
End Sub
ravishankar
 
Upvote 0

Forum statistics

Threads
1,214,864
Messages
6,121,981
Members
449,058
Latest member
oculus

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