ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro Formula (https://www.excelbanter.com/excel-discussion-misc-queries/69432-macro-formula.html)

Corey

Macro Formula
 
All of my macros to date are for formatting, so I'm running into a bit of a
problem for a formula macro. I tend to use this formula often when using
pivot tables, as I need the left most column of the pivot table to poplulate
on every row. For example, the pivot table will result the following:

John Green 2
Red 3
Brown 4
Julie Green 1
Red 2
Brown 3

I really need it to list the names on each row. So I tend to copy the table
and paste it as a value, then use the following formula in the immediate
column to the left of the table data to populate:

=IF(G22="",IF(F21="",G21,F21),G22)

Of course this must be relative to the copied cells position. How can I
write the macro for this and still keep the cell referencing correct?

Any help is much appreciated. Thanks!





Corey

Macro Formula
 
Nevermind....I figured it out.

"Corey" wrote:

All of my macros to date are for formatting, so I'm running into a bit of a
problem for a formula macro. I tend to use this formula often when using
pivot tables, as I need the left most column of the pivot table to poplulate
on every row. For example, the pivot table will result the following:

John Green 2
Red 3
Brown 4
Julie Green 1
Red 2
Brown 3

I really need it to list the names on each row. So I tend to copy the table
and paste it as a value, then use the following formula in the immediate
column to the left of the table data to populate:

=IF(G22="",IF(F21="",G21,F21),G22)

Of course this must be relative to the copied cells position. How can I
write the macro for this and still keep the cell referencing correct?

Any help is much appreciated. Thanks!






All times are GMT +1. The time now is 03:16 AM.

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