Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Array Formula Index Match formulas in VBA problem

I have an array formula in an excel worksheet which compares values o
one sheet to values on another and returns matching data the record.

This formula is as follows:

=INDEX(Subjects!$E$31:$E$511, MATCH($A14 & $M14 & $J14,
Subjects!$B$31:$B$511 & Subjects!$K$31:$K$511 & Subjects!$I$31:$I513
0))

As you can see it is matching 3 columns on the current sheet to
columns on the subjects sheet and returning the value in column E o
the subject sheet for the matching record. This all works fine.

But I would like to move the formula out of the spreadsheet and int
some VBA code, so it will work on the press of a button on th
spreadsheet instead.

The problem is, I can get this type of formula to work in VBA whe
there is a single match e.g.

ActiveCell.Offset(0, 4)
Application.WorksheetFunction.Index(Worksheets("Su bjects").Range("B31:N513")
Application.WorksheetFunction.Match(Comsubno.Value
Worksheets("Subjects").Range("B31:B513"), 1), 13)

But I cannot get multiple matches to work e.g.

ActiveCell.Offset(0, 11)
Application.WorksheetFunction.Index(Worksheets("Su bjects").Range("D31:D511")
Application.WorksheetFunction.Match(Comsubno.Value & Comlabproc.Value
Comtimept.Value, Worksheets("Subjects").Range("B31:B511")
Worksheets("Subjects").Range("K31:K511")
Worksheets("Subjects").Range("I31:I511"), 0))

Any Ideas anyone ????

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Array Formula Index Match formulas in VBA problem

Yes. VBA doesn't support Array evaluation of formulas.

You would have to construct a string that would represent the formula as you
would enter it in a cell, and then use the Evaluate function.

--
Regards,
Tom Ogilvy

"hawkit " wrote in message
...
I have an array formula in an excel worksheet which compares values on
one sheet to values on another and returns matching data the record.

This formula is as follows:

=INDEX(Subjects!$E$31:$E$511, MATCH($A14 & $M14 & $J14,
Subjects!$B$31:$B$511 & Subjects!$K$31:$K$511 & Subjects!$I$31:$I513,
0))

As you can see it is matching 3 columns on the current sheet to 3
columns on the subjects sheet and returning the value in column E on
the subject sheet for the matching record. This all works fine.

But I would like to move the formula out of the spreadsheet and into
some VBA code, so it will work on the press of a button on the
spreadsheet instead.

The problem is, I can get this type of formula to work in VBA when
there is a single match e.g.

ActiveCell.Offset(0, 4) =

Application.WorksheetFunction.Index(Worksheets("Su bjects").Range("B31:N513")
,
Application.WorksheetFunction.Match(Comsubno.Value ,
Worksheets("Subjects").Range("B31:B513"), 1), 13)

But I cannot get multiple matches to work e.g.

ActiveCell.Offset(0, 11) =

Application.WorksheetFunction.Index(Worksheets("Su bjects").Range("D31:D511")
,
Application.WorksheetFunction.Match(Comsubno.Value & Comlabproc.Value &
Comtimept.Value, Worksheets("Subjects").Range("B31:B511") &
Worksheets("Subjects").Range("K31:K511") &
Worksheets("Subjects").Range("I31:I511"), 0))

Any Ideas anyone ?????


---
Message posted from http://www.ExcelForum.com/



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
Array formula with index + match Sena Excel Worksheet Functions 5 April 1st 07 06:06 AM
Index and Match Array formula Graham Haughs Excel Worksheet Functions 4 February 16th 06 01:51 AM
Array index, match problem RAP Excel Worksheet Functions 27 August 21st 05 07:19 PM
Looking for formula index/match-type that returns an array Tom Excel Worksheet Functions 1 April 1st 05 10:05 PM
How to add in an array formula if iisna index match taxmom Excel Worksheet Functions 4 March 15th 05 01:51 PM


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