Filling in blank rows in a Table of data

D

Dave K

I have a table of data with the following layout

Flag Name Service
1 mike service 1
service 2
service 3
1 dave service 1
service 5
1 jeff service 7
service 5
service 4
1 eric service 1
service 9


I am wondering if there is a fomula that will allow me to fill in the
blanks (i.e., the missing names) in the name column. I would imagine
there is some variation of the counta function that I could apply in a
separate column (and then drag down) to produce the results i need.

All that i need is to fill in the blanks so that the table is
complete, and mike's name exists on the same record of each of his
services, and the same for jeff and eric.

Hope this makes sense. Any suggestions would be greatly appreciated.
 
D

Don Guillett

Sub fillinblanks()
mc = 2 'Column B
For i = 2 To Cells(Rows.Count, mc).End(xlUp).Row
If Cells(i, mc) = "" Then Cells(i, mc) = Cells(i - 1, mc)
Next i
End Sub
 
D

Dave K

Thanks so much! It works great.

Sub fillinblanks()
mc = 2 'Column B
For i = 2 To Cells(Rows.Count, mc).End(xlUp).Row
If Cells(i, mc) = "" Then Cells(i, mc) = Cells(i - 1, mc)
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software









- Show quoted text -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top