Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
DAS DAS is offline
external usenet poster
 
Posts: 26
Default Search for a partial number

I have account numbers and the first three numbers determine the location of
the account. What I would like is to have a formula that reads the first
three numbers of the of all the account number and then assign the name of
the account in an adjacent cell.

9895254 would be a "Retail" account
8892532 would be an "Expense" account
etc...
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,344
Default Search for a partial number

Easiest way would be to set up a lookup table. Suppose you create a list of
the first 3 numbers and their corresponding descriptions in range D1:E5. It
might look like
D E
988 Retail
989 Expense
....

Then assume your full length account numbers are in A1:A1000, create the
following formula in B1 and copy it down as needed.

=VLOOKUP(LEFT(A1,3),$D$1:$E$5,2,FALSE)

This will work as is IF the account numbers are text entries, if they are
numbers then change the formula:

=VLOOKUP(VALUE(LEFT(A1,3)),$D$1:$E$5,2,FALSE)

or make the entries in the first column of the range D1:E5 text also. The
data types must match.

--
Cheers,
Shane Devenshire
Microsoft Excel MVP

"das" wrote:

I have account numbers and the first three numbers determine the location of
the account. What I would like is to have a formula that reads the first
three numbers of the of all the account number and then assign the name of
the account in an adjacent cell.

9895254 would be a "Retail" account
8892532 would be an "Expense" account
etc...

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Search for a partial number

On Fri, 30 May 2008 10:37:01 -0700, das wrote:

I have account numbers and the first three numbers determine the location of
the account. What I would like is to have a formula that reads the first
three numbers of the of all the account number and then assign the name of
the account in an adjacent cell.

9895254 would be a "Retail" account
8892532 would be an "Expense" account
etc...


Use the VLOOKUP function, with lookup_value being either LEFT(account_number,3)
or, if the values in your lookup table are numbers, then
--LEFT(account_number,3)
--ron
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
search string for number value samuel Excel Discussion (Misc queries) 3 May 13th 08 10:05 PM
Search number within a database Montu Excel Worksheet Functions 2 December 7th 07 02:08 PM
Partial string search w/o VBA? MJW[_2_] Excel Discussion (Misc queries) 6 October 22nd 07 08:16 PM
search for number in excel Shieldfire Excel Discussion (Misc queries) 0 May 11th 06 03:51 PM
Partial search and replace? Jamie Furlong Excel Discussion (Misc queries) 2 August 28th 05 03:54 PM


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