Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Jim Jim is offline
external usenet poster
 
Posts: 615
Default Three Conditions in one cell

Hello,

I have two columns. Column A has city names which include:
Tri-Cities
Tidewater
Roanoke
Richmond/Tidewater
Richmond
Knoxville
Charlotte

I need help writing a formula that will return CLR, CLK or CLC in Column B.
Here is the break down:

CLR
if Tri-Cities, Tidewater, Roanoke, Richmond/Tidewater or Richmond

CLK
if Knoxville

CLC
if Charlotte

Thanks so much for the help.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 173
Default Three Conditions in one cell

I can think of a couple ways to do this. One is with a nested IF statement.
Assuming the cell you're interrogating is A2, you could use:

=if(or(A2="Tri-Cities", A2="Tidewater", A2="Roanoke",
A2="Richmond/Tidewater", A2="Richmond"),"CLR", if(A2="Knoxville","CLK",
if(A2="Charlotte","CLC","ERROR")))

Another way would be to set up a table with the city names and one column
and the appropriate CLR, CLK, or CLC designation in a second column. You
could then use VLOOKUP to find the correct desitnation.

Hope this helps.
Will

"Jim" wrote:

Hello,

I have two columns. Column A has city names which include:
Tri-Cities
Tidewater
Roanoke
Richmond/Tidewater
Richmond
Knoxville
Charlotte

I need help writing a formula that will return CLR, CLK or CLC in Column B.
Here is the break down:

CLR
if Tri-Cities, Tidewater, Roanoke, Richmond/Tidewater or Richmond

CLK
if Knoxville

CLC
if Charlotte

Thanks so much for the help.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 57
Default Three Conditions in one cell

The best way to approach this is to setup a list on another sheet with the
cities in column A and their respective codes in column B. Then go to Insert
Names Define Name, call your new list something meaningful (like

CityCodes), and enter the following formula for the source:
=offset(Sheet2!$A$1,0,0,counta(Sheeet2!$A:$A),2)

Back to the sheet you're working in now, you'll just use this formula to
retrieve the code (assuming you start with B2):
=vlookup(A2,CityCodes,2,0)

If the city does not exist in your list, you'll get an error (#N/A!),
telling you to get your list updated. You can add new cities and codes any
time on Sheet2.
--
Please remember to indicate when the post is answered so others can benefit
from it later.


"Jim" wrote:

Hello,

I have two columns. Column A has city names which include:
Tri-Cities
Tidewater
Roanoke
Richmond/Tidewater
Richmond
Knoxville
Charlotte

I need help writing a formula that will return CLR, CLK or CLC in Column B.
Here is the break down:

CLR
if Tri-Cities, Tidewater, Roanoke, Richmond/Tidewater or Richmond

CLK
if Knoxville

CLC
if Charlotte

Thanks so much for the help.

  #4   Report Post  
Posted to microsoft.public.excel.misc
Jim Jim is offline
external usenet poster
 
Posts: 615
Default Three Conditions in one cell

Thanks for the help. I see the formula refers to A2, how would this look if
I wanted to refer to the entire column for the lookup?



"roadkill" wrote:

I can think of a couple ways to do this. One is with a nested IF statement.
Assuming the cell you're interrogating is A2, you could use:

=if(or(A2="Tri-Cities", A2="Tidewater", A2="Roanoke",
A2="Richmond/Tidewater", A2="Richmond"),"CLR", if(A2="Knoxville","CLK",
if(A2="Charlotte","CLC","ERROR")))

Another way would be to set up a table with the city names and one column
and the appropriate CLR, CLK, or CLC designation in a second column. You
could then use VLOOKUP to find the correct desitnation.

Hope this helps.
Will

"Jim" wrote:

Hello,

I have two columns. Column A has city names which include:
Tri-Cities
Tidewater
Roanoke
Richmond/Tidewater
Richmond
Knoxville
Charlotte

I need help writing a formula that will return CLR, CLK or CLC in Column B.
Here is the break down:

CLR
if Tri-Cities, Tidewater, Roanoke, Richmond/Tidewater or Richmond

CLK
if Knoxville

CLC
if Charlotte

Thanks so much for the help.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 173
Default Three Conditions in one cell

With this method you need to refer to one cell at a time. Write the formula
in one cell (e.g. B2, referencing A2) and then copy the formula to the rest
of the cells in the column. Excel will automatically adjust the referenced
cell (e.g. A3, A4, A5) going down the column.
Will

"Jim" wrote:

Thanks for the help. I see the formula refers to A2, how would this look if
I wanted to refer to the entire column for the lookup?



"roadkill" wrote:

I can think of a couple ways to do this. One is with a nested IF statement.
Assuming the cell you're interrogating is A2, you could use:

=if(or(A2="Tri-Cities", A2="Tidewater", A2="Roanoke",
A2="Richmond/Tidewater", A2="Richmond"),"CLR", if(A2="Knoxville","CLK",
if(A2="Charlotte","CLC","ERROR")))

Another way would be to set up a table with the city names and one column
and the appropriate CLR, CLK, or CLC designation in a second column. You
could then use VLOOKUP to find the correct desitnation.

Hope this helps.
Will

"Jim" wrote:

Hello,

I have two columns. Column A has city names which include:
Tri-Cities
Tidewater
Roanoke
Richmond/Tidewater
Richmond
Knoxville
Charlotte

I need help writing a formula that will return CLR, CLK or CLC in Column B.
Here is the break down:

CLR
if Tri-Cities, Tidewater, Roanoke, Richmond/Tidewater or Richmond

CLK
if Knoxville

CLC
if Charlotte

Thanks so much for the help.



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 41
Default Three Conditions in one cell

hi Jim,

assumption : your data starts on A1
in B1 type
=IF(A1="","",IF(A1="Charlotte","CLC",IF(A1="Knoxvi lle","CLK","CLR")))
and copy down the fomula as per your need,

click yes below, if it works for you

"Jim" wrote:

Hello,

I have two columns. Column A has city names which include:
Tri-Cities
Tidewater
Roanoke
Richmond/Tidewater
Richmond
Knoxville
Charlotte

I need help writing a formula that will return CLR, CLK or CLC in Column B.
Here is the break down:

CLR
if Tri-Cities, Tidewater, Roanoke, Richmond/Tidewater or Richmond

CLK
if Knoxville

CLC
if Charlotte

Thanks so much for the help.

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 conditions in 2 cell correct then display third cell Paul Hood New Users to Excel 3 January 21st 09 07:30 AM
Countif Conditions - Use of conditions that vary by cell value JonTarg Excel Discussion (Misc queries) 1 May 30th 08 01:21 PM
How do I make a cell refrence another cell based on conditions? Carl Excel Worksheet Functions 1 April 27th 08 03:05 PM
Cell value when conditions are met AG Excel Worksheet Functions 8 January 24th 08 11:35 PM
Conditional formatting Based on cell A text with conditions in Cell B Raicomm Excel Discussion (Misc queries) 0 January 21st 08 04:46 PM


All times are GMT +1. The time now is 04:20 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"