Evaluating A Filter Formula.

HighAndWilder

Well-known Member
Joined
Nov 4, 2006
Messages
726
Office Version
  1. 365
Platform
  1. Windows
I'd like to be able to use the formula in cell L3 in VBA.

I've tried this but I get unexpected results.

Any insights appreciated.

Thanks

VBA Code:
Sub TestIt()
Dim lngRow

  lngRow = Evaluate("IFERROR(TAKE(FILTER(ROW($A$2:$A$13),($C$2:$C$13=5)*($G$2:$G$13=10)),1),0)")

  ' This produces an Error 13 Type Mismatch.
  MsgBox lngRow

  ' BUT this assigns the correct value, 4, to cell M3.
  Range("M3").Value = lngRow

End Sub

Sort array of files in folder - by Date Modified.xlsm
ABCDEFGHIJKL
1C 1C 2C 3C 4C 5C 6C 7C 8C 9
28104635937
3668645742Row4
45553721043
52444718910
64101453232
72107836784
88104635937
9668645742
108510679413
115103833512
12699614639
13255148359
14
Sheet2
Cell Formulas
RangeFormula
L3L3=IFERROR(TAKE(FILTER(ROW($A$2:$A$13),($C$2:$C$13=5)*($G$2:$G$13=10)),1),0)
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
lngRow is an array so you would need to use
VBA Code:
  MsgBox lngRow(1)
 
Upvote 0
Solution

Forum statistics

Threads
1,225,071
Messages
6,182,692
Members
453,132
Latest member
nsnodgrass73

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top