Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Help: Using text from an adjacent cell in a vlookup

Here's the simple formula:

=((VLOOKUP($A3,'C:\Documents and Settings\mkline01\Desktop\New Folder
\[36.xls]Sheet1'!$3:$16,2,FALSE)

I need to replace the 36 from [36.xls] with the value from an adjacent
cell. This will simplify copying this formula over many cells.

There's probably a simply soultion, I just can't find it.

Mark

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Using text from an adjacent cell in a vlookup

To do this with built in functions would *require* that the source file be
open which usually isn't very desireable.

Here's a link to site with an add-in that has a UDF that might do what you
want:

http://xcell05.free.fr/

Look for INDIRECT.EXT

I don't have this add-in but I've seen it mentioned here often.

Biff

"cyberbrewer" wrote in message
oups.com...
Here's the simple formula:

=((VLOOKUP($A3,'C:\Documents and Settings\mkline01\Desktop\New Folder
\[36.xls]Sheet1'!$3:$16,2,FALSE)

I need to replace the 36 from [36.xls] with the value from an adjacent
cell. This will simplify copying this formula over many cells.

There's probably a simply soultion, I just can't find it.

Mark



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 694
Default Help: Using text from an adjacent cell in a vlookup

Hi Mark:

There is not a simple solution to this problem.

The easiest solution is to use INDIRECT but this does not work with closed
workbooks as in:

=((VLOOKUP($A3,indirect("'["& B2 & "]Sheet1'!$3:$16"),2,FALSE)

The other way is to use a worksheet change macro to pick up the change in
the cell

On the sheet tab at the bottom click view code and then paste the following
in.
changing C1 to the cell sheet the worksheet name is.

It also assumes that there is only one [ and ] in the formula for the vlookup.

Option Explicit
Const cszCell As String = "C1" ' cell with the worksheet in
Private Sub Worksheet_Change(ByVal Target As Range)
Dim s As String, s1 As String
If Not (Intersect(Range(cszCell), Target) Is Nothing) Then
With Range(cszCell).Offset(0, -1)
s = .Formula
s1 = Left(s, InStr(1, s, "["))
s1 = s1 & .Offset(0, 1)
s1 = s1 & Right(s, InStr(StrReverse(s), "]"))
.Formula = s1
End With
End If
End Sub
--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"cyberbrewer" wrote:

Here's the simple formula:

=((VLOOKUP($A3,'C:\Documents and Settings\mkline01\Desktop\New Folder
\[36.xls]Sheet1'!$3:$16,2,FALSE)

I need to replace the 36 from [36.xls] with the value from an adjacent
cell. This will simplify copying this formula over many cells.

There's probably a simply soultion, I just can't find it.

Mark


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Help: Using text from an adjacent cell in a vlookup

Thanks very much for the info. The linked workbooks will be closed,
is ther any way to do this without adding macros? If I do add macros
is it possible to paste the formula accross many cells?

Mark


On Feb 11, 6:48 pm, "cyberbrewer" wrote:
Here's the simple formula:

=((VLOOKUP($A3,'C:\Documents and Settings\mkline01\Desktop\New Folder
\[36.xls]Sheet1'!$3:$16,2,FALSE)

I need to replace the 36 from [36.xls] with the value from an adjacent
cell. This will simplify copying this formula over many cells.

There's probably a simply soultion, I just can't find it.

Mark



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 694
Default Help: Using text from an adjacent cell in a vlookup

Mark you can change the link to the cells and modify the code a little

Option Explicit

Const cszCell As String = "C1, C10:C20" ' change this to all the cells.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim s As String, s1 As String
dim rCell as range
for each rCell in target
If Not (Intersect(Range(cszCell), rCell) Is Nothing) Then
With rcell.Offset(0, -1)
s = .Formula
s1 = Left(s, InStr(1, s, "["))
s1 = s1 & .Offset(0, 1)
s1 = s1 & Right(s, InStr(StrReverse(s), "]"))
.Formula = s1
End With
End If
next rCell
End Sub



--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"cyberbrewer" wrote:

Thanks very much for the info. The linked workbooks will be closed,
is ther any way to do this without adding macros? If I do add macros
is it possible to paste the formula accross many cells?

Mark


On Feb 11, 6:48 pm, "cyberbrewer" wrote:
Here's the simple formula:

=((VLOOKUP($A3,'C:\Documents and Settings\mkline01\Desktop\New Folder
\[36.xls]Sheet1'!$3:$16,2,FALSE)

I need to replace the 36 from [36.xls] with the value from an adjacent
cell. This will simplify copying this formula over many cells.

There's probably a simply soultion, I just can't find it.

Mark




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
Vlookup partial text from a single cell Sparky13 Excel Worksheet Functions 4 September 7th 06 01:37 PM
Text entries behaving like numbers jkiser Excel Discussion (Misc queries) 12 August 30th 06 09:29 PM
Shade cell according to text? Ltat42a Excel Discussion (Misc queries) 0 January 3rd 06 06:37 PM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


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