ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro for replacing data (https://www.excelbanter.com/excel-discussion-misc-queries/215405-macro-replacing-data.html)

DA

Macro for replacing data
 
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


Don Guillett

Macro for replacing data
 
A bit clearer?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"da" wrote in message
...
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



veryeavy

Macro for replacing data
 
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

"da" wrote:

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


DA

Macro for replacing data
 
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.

"veryeavy" wrote:

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

"da" wrote:

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


Don Guillett

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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"da" wrote in message
...
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.

"veryeavy" wrote:

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

"da" wrote:

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




All times are GMT +1. The time now is 07:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com