Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default If and Else Statement

=if(a1="Blue","Blue","Not Blue")

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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.


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default If and Else Statement

Excuse my ignorance but how would I implement that code within the
spreadsheet?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF statement inside a SUMIF statement.... or alternative method Sungibungi Excel Worksheet Functions 3 December 4th 09 06:22 PM
Reconcile Bank statement & Credit card statement & accounting data Bklynhyc Excel Worksheet Functions 0 October 7th 09 09:07 PM
Embedding an OR statement in an IF statement efficiently Chatnoir11 Excel Discussion (Misc queries) 4 February 2nd 09 08:12 PM
appending and IF statement to an existing IF statement spence Excel Worksheet Functions 1 February 28th 06 11:00 PM
If statement and Isblank statement Rodney C. Excel Worksheet Functions 0 January 18th 05 08:39 PM


All times are GMT +1. The time now is 07:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"