#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
SteveC
 
Posts: n/a
Default Matching Text

it seems like a simple problem, but I can't find an answer anywhere.

Worksheet One
Column A Column B
Apples Little Apples
Apples Green Apples
Apples Big Apples
Pears Big Pears
Pears Little Pears
Bannanas Green Banannas

Work Sheet Two:
Column A Column B
Little Apples
Green Bannannas
Big Apples
Big Apples
Green Bannans
etc


I need a formula in WorkSheet 2 of Column A to return the appropriate
category based on the text value in Colum B.

Thanks very much for taking a look.

Steve
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
SteveG
 
Posts: n/a
Default Matching Text


In worksheet 2 if your values are in B1:B6 and your values to match are
in worksheet1!A1:B6 then in worksheet 2 A1,

=INDEX(Worksheet1!$A$1:$B$6,MATCH(Worksheet2!B1,Wo rksheet1!$B$1:$B$6,0),1)

Copy down your items to match.

HTH

Steve


--
SteveG
------------------------------------------------------------------------
SteveG's Profile: http://www.excelforum.com/member.php...fo&userid=7571
View this thread: http://www.excelforum.com/showthread...hreadid=526095

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
SteveC
 
Posts: n/a
Default Matching Text

SteveG, thanks:

Sometimes the formula works, other times I get #N/A errors when I use this
formula. I don't see any mispellings or other mismatches. Do you think it
would help to apply a similar formula just by matching the first few text
characters?

At the end of the formula I've tried changing the 0 to 1, but that doesn't
return the right value.

I believe I copied the formula correctly: this is what it looks like in my
worksheet now:

=INDEX(AllCos!$A$4:$B$140,MATCH(C8,AllCos!$B$4:$B$ 140,0),1)

Worksheet2 = AllCos
Worksheet1 is referenced by C8

Thanks very much.
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
SteveG
 
Posts: n/a
Default Matching Text


You probably have spaces at the end of some of your values. If you'd
rather lookup and match by the first say 8 characters you could use
this array formula.

=INDEX(Sheet1!$A$1:$A$6,MATCH(LEFT(Sheet2!B1,8),LE FT(Sheet1!$B$1:$B$6,8),0),1)

After typing the formula, hit Ctrl-Shift-Enter simultaneously. This
will create the array formula which will then appear as:

{=INDEX(Sheet1!$A$1:$A$6,MATCH(LEFT(Sheet2!B1,8),L EFT(Sheet1!$B$1:$B$6,8),0),1)}

Don't type the {} in yourself.

One suggestion is that you pick enough characters to ensure a match for
all possibilities. I chose 8 because it compared the entire first word
and at least the first letter of the second word for a match. For
instance, if you had Little Apples and Little Avacados, 8 would return
the first match, if you used 9, it would ensure it was looking at
"Little Av" or "Little Ap".

Array formulas can be a pain if you have a lot of users that are not
familiar with them using your workbook. You have to remember to always
commit with Ctrl-Shift-Enter.

I am working on incorporating the TRIM function in my original post
which may be easier but for now, if you are comfortable with the above,
it worked fine for me using your sample data.

HTH

Steve


--
SteveG
------------------------------------------------------------------------
SteveG's Profile: http://www.excelforum.com/member.php...fo&userid=7571
View this thread: http://www.excelforum.com/showthread...hreadid=526095

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
SteveG
 
Posts: n/a
Default Matching Text


Here you go. This will work.


=INDEX(TRIM(Sheet1!$A$1:$A$6),MATCH(TRIM(Sheet2!B1 ),TRIM(Sheet1!$B$1:$B$6),0),1)

This also an array formula. Commit with Ctrl-Shift-Enter.

HTH
Steve


--
SteveG
------------------------------------------------------------------------
SteveG's Profile: http://www.excelforum.com/member.php...fo&userid=7571
View this thread: http://www.excelforum.com/showthread...hreadid=526095



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
SteveC
 
Posts: n/a
Default Matching Text

Super! Thanks very much. I really appreciate it.
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
merged cells into one text cell, size varies dependant on text dat Jazzylady825 Excel Discussion (Misc queries) 0 December 9th 05 08:26 PM
Linked cells and text boxes Alexlondon11 Excel Discussion (Misc queries) 2 November 23rd 05 04:10 PM
dates and text Sloth Excel Discussion (Misc queries) 0 November 18th 05 04:16 PM
SUMPRODUCT vs Text??? Ken Excel Worksheet Functions 2 April 9th 05 07:21 PM
Read Text File into Excel Using VBA Willie T Excel Discussion (Misc queries) 13 January 8th 05 12:37 AM


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