Macro for replacing data

D

da

Hi
If I want to replace 0 with a name above zero, is there a way to do it? I
have about 350 names to replace, where the zero is under the name row. I got
the zero when tried to get a sub total of hours and amount columns (not
shown).

thank you and Happy New Year.


8 SANTIAGO
8 SANTIAGO
8 SANTIAGO
8 SANTIAGO
8 SANTIAGO
8 SANTIAGO
8 SANTIAGO
8 SANTIAGO
8 SANTIAGO
8 SANTIAGO
8 SANTIAGO
8 SANTIAGO
8 SANTIAGO
8 SANTIAGO
8 SANTIAGO
8 SANTIAGO
8 SANTIAGO
8 SANTIAGO
8 SANTIAGO
8 SANTIAGO
8 SANTIAGO
8 SANTIAGO
8 SANTIAGO
8 Total 0
14 LECOURS
14 LECOURS
14 LECOURS
14 LECOURS
14 LECOURS
14 LECOURS
14 LECOURS
14 LECOURS
14 LECOURS
14 Total 0
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 BRUNO
25 Total 0
 
V

veryeavy

Hi There Da,

Many different ways you can achieve this without macros. I would try
inserting a formula in column C starting in Row 2 that says:

=IF(B2=0,+B1,B2)

Copy it down to the bottom of you data and make sure you are geting the
desired result.

then Copy Paste Special Values it over Column B and delete the formula from
Column C.

You could alternately use a formula that says:

=IF(RIGHT(A2,2)="al",+B1,+B2)

and do the same with it as the previous suggestion.

HTH and Good Luck,

Matt
 
D

da

Thanks for your help. The formula works; I copied it for few names and it
worked. However, I have over 35,000 records and I have to insert the formula
at each sub-total row for each name. There are over 400 names in the
spreadsheet, which makes it very cumbersome to use the formula. I may have to
copy the last name for each name. Anyway, thanks for your help.
 
D

Don Guillett

If desired, send me a sample workbook with a clear explanation and
before/after examples
 

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