Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Gus
 
Posts: n/a
Default vlookup on large text in cells

Any help with the following would be greatly appreciated -
I'm trying to do a vlookup whereby the cell that contains the data to be
searched and the column that will be searched, contain large amounts of text.
Having realised large amounts of text seem to be the problem (as vlookup
returned correct answers when cells had < 200 characters in them) I tried to
use a formular to lookup only the first 100 characters in the cells:

=VLOOKUP(LEFT(B1,200)&"*",'[Regs2.xls]Agr-Tra'!E4:N1800,3,0)

This formular returned the wrong data for the cells with < 200 characters
and #N/As for the cells with 200 characters.

Is it therefore possible to do a vlookup on a large amount of text contained
within both the column to be searched and cell to be matched?

Many thanks in advance for any help.
Gus
  #2   Report Post  
Harlan Grove
 
Posts: n/a
Default

Gus wrote...
Any help with the following would be greatly appreciated -
I'm trying to do a vlookup whereby the cell that contains the data to be
searched and the column that will be searched, contain large amounts of text.
Having realised large amounts of text seem to be the problem (as vlookup
returned correct answers when cells had < 200 characters in them) I tried to
use a formular to lookup only the first 100 characters in the cells:

=VLOOKUP(LEFT(B1,200)&"*",'[Regs2.xls]Agr-Tra'!E4:N1800,3,0)

This formular returned the wrong data for the cells with < 200 characters
and #N/As for the cells with 200 characters.

Is it therefore possible to do a vlookup on a large amount of text contained
within both the column to be searched and cell to be matched?

....

The short answer is NO it's not possible to use VLOOKUP with very long
text strings. A little experimentation would show that VLOOKUP works up
to 255 characters in its 1st argument. E.g., if I enter the following

A1:
x

B1:
1

A2:
=REPT("x",D2)

B2:
2

D2:
255

A4:
=VLOOKUP(A2,A1:B2,2,0)

the VLOOKUP call in cell A4 returns 2, but if I then increase D2 to
256, the VLOOKUP call in A4 returns #VALUE!. I'd need to replace the
1st argument to VLOOKUP with =REPT("x",254)&"*" in order to get a match
using the longest possible exact leftmost substring.

So either use

LEFT(<YourSearchStringHere,254)&"*"

or

"*"&MID(<YourSearchStringHere,<YourStartPositionH ere,254)&"*"

if partial matching would work, or figure out some way of indexing or
condensing these long strings.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
SteveC
 
Posts: n/a
Default vlookup on large text in cells

Harlan, et al,

Is it possible to do a partial match between text in two separate columns?

For example

Col A Col B
Hawaii Sports Inc. Hawaii Sprts

A formula in Col C would return Col A text: "Hawaii Sports Inc."

Because any text in Col B matches any text in Col A -- in this case the
matching text is "Hawaii"

Thanks very much.

"Harlan Grove" wrote:

Gus wrote...
Any help with the following would be greatly appreciated -
I'm trying to do a vlookup whereby the cell that contains the data to be
searched and the column that will be searched, contain large amounts of text.
Having realised large amounts of text seem to be the problem (as vlookup
returned correct answers when cells had < 200 characters in them) I tried to
use a formular to lookup only the first 100 characters in the cells:

=VLOOKUP(LEFT(B1,200)&"*",'[Regs2.xls]Agr-Tra'!E4:N1800,3,0)

This formular returned the wrong data for the cells with < 200 characters
and #N/As for the cells with 200 characters.

Is it therefore possible to do a vlookup on a large amount of text contained
within both the column to be searched and cell to be matched?

....

The short answer is NO it's not possible to use VLOOKUP with very long
text strings. A little experimentation would show that VLOOKUP works up
to 255 characters in its 1st argument. E.g., if I enter the following

A1:
x

B1:
1

A2:
=REPT("x",D2)

B2:
2

D2:
255

A4:
=VLOOKUP(A2,A1:B2,2,0)

the VLOOKUP call in cell A4 returns 2, but if I then increase D2 to
256, the VLOOKUP call in A4 returns #VALUE!. I'd need to replace the
1st argument to VLOOKUP with =REPT("x",254)&"*" in order to get a match
using the longest possible exact leftmost substring.

So either use

LEFT(<YourSearchStringHere,254)&"*"

or

"*"&MID(<YourSearchStringHere,<YourStartPositionH ere,254)&"*"

if partial matching would work, or figure out some way of indexing or
condensing these long strings.


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
How to combine text from multiple cells? sierra Excel Worksheet Functions 3 July 11th 05 01:55 PM
retrieve text from merged cells Eric Excel Worksheet Functions 3 July 9th 05 09:17 AM
Cells formated as numbers are calculating like text MM_BAM Excel Discussion (Misc queries) 4 July 7th 05 01:29 AM
Macro or Formula to remove Text from Cells smck Excel Worksheet Functions 6 May 11th 05 03:22 AM
Referencing cells text output if it meets specific conditions Chersie Excel Worksheet Functions 3 April 18th 05 04:34 PM


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

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"