#1   Report Post  
Posted to microsoft.public.excel.misc
Renee Nguy
 
Posts: n/a
Default If and Then Formula

This is what I currently have:
A1=09508375, then B1 should be San Diego because the account number starts
with 09
A2=18509068, then B2 should be Newport because the account number starts
with 18
A3=13500291, then B3 should be Portland because the account number starts
with 13
Please help me create a formula where it will pick up the first two digits
of the account number in column A and match it to the location and provide
the correct location in column B.
Thank you so much.
Renee
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default If and Then Formula

Start a new worksheet in the same workbook. I'll call it Sheet2

Put the numbers in column A and the cities in column B.

Then put this in B1 of sheet1:
=if(a1="","",if(iserror(vlookup(--left(a1,2),sheet2!a:b,2,false)),"Missing",
vlookup(--left(a1,2),sheet2!a:b,2,false)))

You may want to read Debra Dalgleish's notes:
http://www.contextures.com/xlFunctions02.html (for =vlookup())
and
http://www.contextures.com/xlFunctions03.html (for =index(match()))

Renee Nguy wrote:

This is what I currently have:
A1=09508375, then B1 should be San Diego because the account number starts
with 09
A2=18509068, then B2 should be Newport because the account number starts
with 18
A3=13500291, then B3 should be Portland because the account number starts
with 13
Please help me create a formula where it will pick up the first two digits
of the account number in column A and match it to the location and provide
the correct location in column B.
Thank you so much.
Renee


--

Dave Peterson
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



All times are GMT +1. The time now is 12:19 PM.

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

About Us

"It's about Microsoft Excel"