Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default programming of matrix formulas in vba

hi

I use the formula {=if(A2:A6<B1:D1);1;0} to fill the cells b2:d6 with the
information whether the values in column A are smaller than the values given
in row 1.

Now I want to program this formula in VBA (without running through "while -
wend" or "for- next" loops. This would be advantegous if one have to handle
with big data files.

But - I don't how to do this.
Of course I've started with introducing the arrays. But then ..?

Thanks - Thomas



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default programming of matrix formulas in vba


Thokel

FormulaARRAY property needs an r1c1 reference.
If you;re not familiar with r1c1 notation let Convertformula do the
translation from a1 to r1c1 for you.

PLEASE note you're braces were incorrect!
and you'll have to use USenglish separators.

Sub DoArrayFml()
Dim sFml$
sFml = "=IF(A2:A6<B1:D1,1,0)"
Range("g1:g10").FormulaArray = _
Application.ConvertFormula(sFml, xlA1, xlR1C1)
End Sub



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


thokel wrote :

if(A2:A6<B1:D1);1;0

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default programming of matrix formulas in vba

VBA's help isn't quite true with the R1C1 reference style for arrayformulas.

This version of KeepItCool's routine worked fine for me:

Option Explicit
Sub DoArrayFm2A()
Dim sFml$
sFml = "=IF(A2:A6<B1:D1,1,0)"
Range("b2:d6").FormulaArray = sFml
End Sub




thokel wrote:

hi

I use the formula {=if(A2:A6<B1:D1);1;0} to fill the cells b2:d6 with the
information whether the values in column A are smaller than the values given
in row 1.

Now I want to program this formula in VBA (without running through "while -
wend" or "for- next" loops. This would be advantegous if one have to handle
with big data files.

But - I don't how to do this.
Of course I've started with introducing the arrays. But then ..?

Thanks - Thomas


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default programming of matrix formulas in vba

Dave,

you are correct,
but worse... my r1c1 conversion is lacking
the relativeto argument, making it work only
when a1 is activecell.

Sub DoArrayFmlR1C1()
Dim sFml$
sFml = "=IF(A2:A6<B1:D1,1,0)"
Range("g1:g10").FormulaArray = _
Application.ConvertFormula(sFml, xlA1, xlR1C1, , Range("g1"))
End Sub

so I'll use a1 notation..


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Dave Peterson wrote :

VBA's help isn't quite true with the R1C1 reference style for
arrayformulas.

This version of KeepItCool's routine worked fine for me:

Option Explicit
Sub DoArrayFm2A()
Dim sFml$
sFml = "=IF(A2:A6<B1:D1,1,0)"
Range("b2:d6").FormulaArray = sFml
End Sub




thokel wrote:

hi

I use the formula {=if(A2:A6<B1:D1);1;0} to fill the cells b2:d6
with the information whether the values in column A are smaller
than the values given in row 1.

Now I want to program this formula in VBA (without running through
"while - wend" or "for- next" loops. This would be advantegous if
one have to handle with big data files.

But - I don't how to do this.
Of course I've started with introducing the arrays. But then ..?

Thanks - Thomas

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default programming of matrix formulas in vba

Incorrect documentation is sometimes a PITA, huh?

keepITcool wrote:

Dave,

you are correct,
but worse... my r1c1 conversion is lacking
the relativeto argument, making it work only
when a1 is activecell.

Sub DoArrayFmlR1C1()
Dim sFml$
sFml = "=IF(A2:A6<B1:D1,1,0)"
Range("g1:g10").FormulaArray = _
Application.ConvertFormula(sFml, xlA1, xlR1C1, , Range("g1"))
End Sub

so I'll use a1 notation..

--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam

Dave Peterson wrote :

VBA's help isn't quite true with the R1C1 reference style for
arrayformulas.

This version of KeepItCool's routine worked fine for me:

Option Explicit
Sub DoArrayFm2A()
Dim sFml$
sFml = "=IF(A2:A6<B1:D1,1,0)"
Range("b2:d6").FormulaArray = sFml
End Sub




thokel wrote:

hi

I use the formula {=if(A2:A6<B1:D1);1;0} to fill the cells b2:d6
with the information whether the values in column A are smaller
than the values given in row 1.

Now I want to program this formula in VBA (without running through
"while - wend" or "for- next" loops. This would be advantegous if
one have to handle with big data files.

But - I don't how to do this.
Of course I've started with introducing the arrays. But then ..?

Thanks - Thomas


--

Dave Peterson
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 can I transpose nXm matrix to mXn Matrix MIHir Excel Worksheet Functions 2 August 9th 08 11:44 AM
strange behaviour with matrix formulas kayard Excel Worksheet Functions 3 May 16th 06 04:07 PM
Programming Formulas animal1881 Excel Programming 1 July 31st 04 12:59 AM
Programming Array Formulas in VBA - Can they be intermediate results in RAM? Bill Hertzing Excel Programming 4 February 17th 04 07:04 PM
Array formulas into VB programming Angelo Battistoni Excel Programming 3 August 28th 03 05:34 PM


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