A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

If part of a cell = "NVA" then insert "Norfolk" in return cell



 
 
Thread Tools Display Modes
  #1  
Old June 13th, 2009, 07:45 PM posted to microsoft.public.excel.worksheet.functions
RNCKWMN
external usenet poster
 
Posts: 1
Default If part of a cell = "NVA" then insert "Norfolk" in return cell

Column C has various 8 character codes (city & state abbreviations). One #
and 7 alpha. If the 2nd, 3rd & 4th characters = "NVA" then I want it to
return "Norfolk" in a Column J... if they = "RVA" it should return "Richmond"

Column C Column J
0NVARIVA should yield Norfolk
2RVACFVA should yield Richmond
1SNCEUNC should yield Selma

What formula or function do i use to make this happen?
  #2  
Old June 13th, 2009, 08:08 PM posted to microsoft.public.excel.worksheet.functions
joeu2004
external usenet poster
 
Posts: 1,748
Default If part of a cell = "NVA" then insert "Norfolk" in return cell

"RNCKWMN" wrote:
What formula or function do i use to make this happen?


=lookup(mid(C1,2,3), {"NVA","RVA","SNC"}, {"Norfolk","Richmond","Selma"})

That makes it simple to extend to additional codes. However, if need to
cover "none of the above", post back for additional assistance, specifying
your version of Excel.


----- original message -----

"RNCKWMN" wrote in message
...
Column C has various 8 character codes (city & state abbreviations). One #
and 7 alpha. If the 2nd, 3rd & 4th characters = "NVA" then I want it to
return "Norfolk" in a Column J... if they = "RVA" it should return
"Richmond"

Column C Column J
0NVARIVA should yield Norfolk
2RVACFVA should yield Richmond
1SNCEUNC should yield Selma

What formula or function do i use to make this happen?


  #3  
Old June 13th, 2009, 08:14 PM posted to microsoft.public.excel.worksheet.functions
Allllen[_2_]
external usenet poster
 
Posts: 10
Default If part of a cell = "NVA" then insert "Norfolk" in return cell

Judging by the third example "Selma" I would guess you have many more places
than just Norfolk and Richmond.

=MID(C2,2,3)
gives you the NVA, RVA, SNC

You can have some extra columns, let's say X and Y, where you will have the
correspondence between NVA and Norfol etc:

Col X Col Y
NVA Norfolk
RVA Richmond
SNC Selma
etc

So what you need in column J will be:
=VLOOKUP(MID(C2,2,3),X:Y,2,0)

--
Allllen


"RNCKWMN" wrote:

Column C has various 8 character codes (city & state abbreviations). One #
and 7 alpha. If the 2nd, 3rd & 4th characters = "NVA" then I want it to
return "Norfolk" in a Column J... if they = "RVA" it should return "Richmond"

Column C Column J
0NVARIVA should yield Norfolk
2RVACFVA should yield Richmond
1SNCEUNC should yield Selma

What formula or function do i use to make this happen?

  #4  
Old June 13th, 2009, 08:30 PM posted to microsoft.public.excel.worksheet.functions
Shane Devenshire[_3_]
external usenet poster
 
Posts: 3,333
Default If part of a cell = "NVA" then insert "Norfolk" in return cell

Hi,

Suppose you create a little lookup table in L1:M3:

NVA Norfolk
RVA Richmond
SNC Selma

then your formula in J1 would be

=LOOKUP(MID(C1,2,3),L$1:M$3)

If you named the range L1:M3 "T" then this would be

=LOOKUP(MID(C1,2,3),T)
--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"RNCKWMN" wrote:

Column C has various 8 character codes (city & state abbreviations). One #
and 7 alpha. If the 2nd, 3rd & 4th characters = "NVA" then I want it to
return "Norfolk" in a Column J... if they = "RVA" it should return "Richmond"

Column C Column J
0NVARIVA should yield Norfolk
2RVACFVA should yield Richmond
1SNCEUNC should yield Selma

What formula or function do i use to make this happen?

  #5  
Old June 13th, 2009, 08:53 PM posted to microsoft.public.excel.worksheet.functions
francis
external usenet poster
 
Posts: 119
Default If part of a cell = "NVA" then insert "Norfolk" in return cell

assuming you start at row 1 with no header. try this in cell J1
=IF(MID(C1,2,3)="NVA","Norfolk",IF(MID(C1,2,3)="RV A","Richmond",IF(MID(C1,2,3)="SNC","Selma","not in list")))

"RNCKWMN" wrote:

Column C has various 8 character codes (city & state abbreviations). One #
and 7 alpha. If the 2nd, 3rd & 4th characters = "NVA" then I want it to
return "Norfolk" in a Column J... if they = "RVA" it should return "Richmond"

Column C Column J
0NVARIVA should yield Norfolk
2RVACFVA should yield Richmond
1SNCEUNC should yield Selma

What formula or function do i use to make this happen?

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:56 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.