Question:
Excel Macro Question!?
Zeph
2008-07-18 09:16:27 UTC
I need this asap for a Project at work...too dumb to figure it out..

Lets say that I have three columns
'T' 'U' 'V'
There is data in some cells of T but not in all of them. The data is date in the cells of 'T'.
What I want the macros to do is

If 'T' has a cell with date (the data) in it then the Macros Puts an "X" in the Column 'U', if 'T' has a cell without anything in it then the Macros Puts an "X" in the Column 'V'

Can this be possible?

Here is an example:
T2 = No Data....Hence, the Macros Places a "X" in 'V2'
T5 = 07/26/2008....Hence, the Macros Places a "X" in 'U5'
T6 = No Data....Hence, the Macros Places a "X" in 'V6'
T7 = No Data....Hence, the Macros Places a "X" in 'V7'
T8 = No Data....Hence, the Macros Places a "X" in 'V8'
T9 = No Data....Hence, the Macros Places a "X" in 'V9'
T10 = 02/10/2006....Hence, the Macros Places a "X" in 'U10'

That is basically what I want it to do...
Four answers:
2008-07-19 10:44:42 UTC
This is easy.



You can find out if the cell is blank by using the function ISBLANK(cell).



I am going to assume that the cells in column T have dates or blank. In other words the column T does not contain any thing other than dates, like text or numbers.



In column U, row 2 (I am assuming row 1 has titles) enter this formula:



=IF(ISBLANK(T2)=FALSE,"X"," ")



This formula interrogates the cell T2 and if it is not blank, it would put an X in column U.



Copy the formula from cell U2 down to as many rows as you need.



Similarly, In Column V, row 2, enter this formula:



=IF(ISBLANK(T2)=TRUE,"X"," ")



This formula will put an X in column V if the cell T2 is indeed blank.



Copy the formula down to as many rows as you need.



Have Fun.
aplpie
2008-07-18 09:28:58 UTC
from what it looks like you are not trying to do a macro but an if and then statement. So i would go to the excel formula and look for IF. And then just write the statement.



=IF(B1>0,X,0)



This is what your formula would look like. Except you have to change the cell.



I think u can figure out from here
Rachel
2008-07-18 09:25:51 UTC
This could be done with a macro, but I think formulas would be easier.

In column u: =if(T2="","X","")

In column v: =if(T2<>"","X","")



Drag the formulas to the end of your data
jmorge
2008-07-18 09:27:05 UTC
in U2, enter

=if(ISBLANK(T2)=FALSE, X, "")

(this formual is basically stating, if T2 is not blank, then result is X, otherwise result is blank)

in V2 enter

=if(ISBLANK(T2)=TRUE, X, "")

(this is stating, if T2 IS blank, then put an X, otherwise but a blank).

just copy this formula down to T5, T6, etc.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...