ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   macro or if statement (https://www.excelbanter.com/excel-worksheet-functions/122028-macro-if-statement.html)

CHARI

macro or if statement
 
If I have a value in a1 and I want that copied to a2 only if I have a value
in d2. I tried an If statement but I ended up removing some of the data from
column a because the if statement said if d2<"",a1,""

any way to copy the formula better or would a macro work better?

Elkar

macro or if statement
 
I'm not sure I understand what exactly you're trying to do. Do you want a
formula that you can copy down column A to display the contents of cell A1 if
the corresponding cell in column D contains data? If so, then try this:

=IF(D2<"",$A$1,"")

The use of the $ symbols will prevent the cell reference from incrementing
when the formula is copied.

HTH,
Elkar


"CHARI" wrote:

If I have a value in a1 and I want that copied to a2 only if I have a value
in d2. I tried an If statement but I ended up removing some of the data from
column a because the if statement said if d2<"",a1,""

any way to copy the formula better or would a macro work better?


CHARI

macro or if statement
 
Because A1 changes, I can't copy this down as it keeps the same value. In
example cust one has no value below TT017 so A2 can remain blank. In cust
two, there is a value of TTL017 below APR199 so I want the acct # for cust
two copied in same row as TTL017.

a1 acct # cust 1 TTL017
a2
a3 acct # cust 2 APR199
a4 TTL017



"Elkar" wrote:

I'm not sure I understand what exactly you're trying to do. Do you want a
formula that you can copy down column A to display the contents of cell A1 if
the corresponding cell in column D contains data? If so, then try this:

=IF(D2<"",$A$1,"")

The use of the $ symbols will prevent the cell reference from incrementing
when the formula is copied.

HTH,
Elkar


"CHARI" wrote:

If I have a value in a1 and I want that copied to a2 only if I have a value
in d2. I tried an If statement but I ended up removing some of the data from
column a because the if statement said if d2<"",a1,""

any way to copy the formula better or would a macro work better?



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

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