ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If and Else Statement (https://www.excelbanter.com/excel-programming/377726-if-else-statement.html)

BlackJackal

If and Else Statement
 
Alright this is what I need to do. I need to be able to automatically
assign information into a column based on the data entered into another
column in this manner. If in column A the information entered is
anything but "blue" I want the text "not blue" entered into column B.
If blue in entered into column A then column B should read "blue". For
Example:

Column A Column B
red not blue
green not blue
purple not blue
blue blue

I can't seem to figure this one out thanks in advance.


curlydave

If and Else Statement
 
=if(a1="Blue","Blue","Not Blue")


alondon

If and Else Statement
 
Black,

For complex relationships, set aside a range on your sheet to build a
relationship table, then use VLookup in column B. For what you described
below, why not use:

IF(a$1<"blue","not blue","blue")

Simple - No VBA required in either case.

Allan P. London, CPA
"The Future and Reality - Close the Gap"



"BlackJackal" wrote in message
ups.com...
Alright this is what I need to do. I need to be able to automatically
assign information into a column based on the data entered into another
column in this manner. If in column A the information entered is
anything but "blue" I want the text "not blue" entered into column B.
If blue in entered into column A then column B should read "blue". For
Example:

Column A Column B
red not blue
green not blue
purple not blue
blue blue

I can't seem to figure this one out thanks in advance.




BlackJackal

If and Else Statement
 
Thank you so much for the fast responce but I do have one more
question. Is there a way to manipulate the formula so that if the
intial column is blank the resulting column will also be blank. For
example:

Column A Column B
blue blue
red not blue
<blank <blank


JLGWhiz

If and Else Statement
 
If you want it in VBA, this assumes row 1 for headers and your variable
colors in Col A with Col B blank.

Sub mtchClr()
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
myRange = Range(Cells(2, 1), Cells(LastRow, 1))
myClr = LCase("Blue")
c = 2
For Each i In myRange
If LCase(i) = myClr Then
Cells(c, 1).Offset(0, 1) = "Blue"
Else
Cells(c, 1).Offset(0, 1) = "Not Blue"
End If
c = c + 1
Next i
End Sub

"BlackJackal" wrote:

Alright this is what I need to do. I need to be able to automatically
assign information into a column based on the data entered into another
column in this manner. If in column A the information entered is
anything but "blue" I want the text "not blue" entered into column B.
If blue in entered into column A then column B should read "blue". For
Example:

Column A Column B
red not blue
green not blue
purple not blue
blue blue

I can't seem to figure this one out thanks in advance.



BlackJackal

If and Else Statement
 
Excuse my ignorance but how would I implement that code within the
spreadsheet?


Tom Ogilvy

If and Else Statement
 
=if(a1="","",if(a1="Blue","Blue","Not Blue"))

the cell with the formula won't be truly blank, but will appear blank.

--
Regards,
Tom Ogilvy



"BlackJackal" wrote in message
ups.com...
Thank you so much for the fast responce but I do have one more
question. Is there a way to manipulate the formula so that if the
intial column is blank the resulting column will also be blank. For
example:

Column A Column B
blue blue
red not blue
<blank <blank





All times are GMT +1. The time now is 05:48 PM.

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