# Microsoft Office Application Help - Excel Help forum > Excel Programming / VBA / Macros >  >  Query :IF cell "X" = not blank then input value "YES" to cell "Y" otherwise input value "N

## petesdawi

Hi there, 

I an excel amateur excel user and would like someone to help me with this query. 

Basically I have a database spreadsheet export and want to be able to sort more effectively.  
if there is no address details in the address column I want my address Y/N column to have the value YES or NO. I.e. I want to do this for phone, email etc columns so I can sort our database on clients where we have only their address or phone or both. 

Query : IF cell "X" = not blank then input value "YES" to cell "Y" otherwise input value "NO" 

I will make one paypal $5 donation to the first useful response  :Smilie: 

Many Thanks, 

Pete

----------


## Russell Dawson

Hi Pete

Welcome to the forum.

Assuming your cell is A1 then in your address Y/N column put =IF(A1<>"","YES","NO") and similarly for the other columns.

----------


## Fotis1991

Hi and welcome to the forum.

Do you mean something like this in cell "Y"?

*=IF(A1<>"","YES","NO)*

----------


## Russell Dawson

Fotis,

Ha,  good morning  :Smilie: 

Fotis - 10,000       Russell - 2

 :Wink:

----------


## Fotis1991

Good morning to you! :Smilie:

----------


## petesdawi

Thanks for that! Worked a treat, seems like a logical bit of programming now that I look at it. 

Please send me your email address for PayPal. 

Many Thanks, 

Pete

----------


## Russell Dawson

I think Fotis would agree that a donation to your own charity would be in order.

----------


## Fotis1991

@Pete

You are welcome!

@ Russell





> .....I think Fotis would agree that a donation to your own charity would be in order.



Good morning!

Of course, i agree! :Smilie:

----------


## Russell Dawson

Good morning Fotis -  :Smilie:

----------


## petesdawi

Great idea, made a $10 donation to http://www.rspca.org.au/ 

Thanks again Excel gurus!

----------


## petesdawi

Great idea, made a $10 donation to http://www.rspca.org.au/ 

Thanks again Excel gurus!

----------


## Russell Dawson

Excellent - thankyou

----------


## Fotis1991

Excellent move.

If everyone thinks like you, we would have a better world!

Congratulations!

----------


## senator.blair

Hello, I used the above code correctly, THANKS! 
To further the knowledge base here:

I would like to know how to make the output dependent upon two columns.

In other words, If column A is not blank, and B is also not blank, C should be X (ultimately I want it green but a simple 1 or 0 is fine).

----------


## FDibbins

Hi senator.blair, welcome to the forum  :Smilie: 

Unfortunately _your post does not comply with Rule 2 of our Forum_ RULES. *Do not post a question in the thread of another member -- start your own thread.* 

If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread. 

Old threads are often only monitored by the original participants.  New threads not only open you up to all possible participants again, they typically get faster response, too.

(take a look at using AND for this, and Conditional Formatting for making the color change)

----------


## senator.blair

Also - how do I change it depending on if A or B is blank to be a different output.

Example, A has appellants or not. 
B has coversheets or not.
C should be green if there are appellants & coversheets, or yellow if one is missing.



I wish I wasn't a starving student with 200k in loans so I could donate too!

----------


## FDibbins

senator, please read my post #15

----------


## nmsmith

I believe there is also a ISBLANK command in excel that may be useful

----------

