Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Offset in User Defined Function

I am trying to create a user defined function to simplify an INDEX-MATCH lookup

Public Function XLOOKUP(Range, Column, Row
XLOOKUP = Index(Range, Match(Row, Offset(Range, 0, 0, 0, 1), 0), Match(Column, Offset(Range, 0, 0, 1, 0), 0)
End Functio

However, when I use the function I get an error

Compile error
Sub or Function not define

and the first OFFSET function is highlighted

Any help would be appreciated

Thanks
Mark Graesse

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Offset in User Defined Function

I figured out my first problem and rewrote the function

Public Function XLOOKUP(Range, Column, Row
XLOOKUP =
WorksheetFunction.Index(Range,
WorksheetFunction.Match(Row, WorksheetFunction.Offset(Range, 0, 0, , 1), 0),
WorksheetFunction.Match(Column, WorksheetFunction.Offset(Range, 0, 0, 1), 0)
End Functio

Now I get a #VALUE error when I use it. The formula works fine when I copy it into the worksheet, replaced the WorksheetFunction. with nothing and removed the XLOOKUP

Any ideas

Thanks
Mark Graesse


----- Mark Graesser wrote: ----

I am trying to create a user defined function to simplify an INDEX-MATCH lookup

Public Function XLOOKUP(Range, Column, Row
XLOOKUP = Index(Range, Match(Row, Offset(Range, 0, 0, 0, 1), 0), Match(Column, Offset(Range, 0, 0, 1, 0), 0)
End Functio

However, when I use the function I get an error

Compile error
Sub or Function not define

and the first OFFSET function is highlighted

Any help would be appreciated

Thanks
Mark Graesse

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
user defined function Pete_T Excel Worksheet Functions 1 December 1st 07 01:03 AM
user defined function help Floyd Steele Excel Worksheet Functions 1 February 2nd 06 10:47 PM
user defined function Brian Rogge Excel Worksheet Functions 5 May 23rd 05 06:21 PM
USer Defined Function Excel Dummy[_2_] Excel Programming 2 November 5th 03 11:33 AM
User-Defined Function pre-empting Built-in Function? How to undo???? MarWun Excel Programming 1 August 6th 03 09:31 PM


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