Evaluating A Filter Formula.

HighAndWilder

Well-known Member
Joined
Nov 4, 2006
Messages
808
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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
lngRow is an array so you would need to use
VBA Code:
  MsgBox lngRow(1)
 
Upvote 0
Solution

Forum statistics

Threads
1,226,116
Messages
6,189,057
Members
453,523
Latest member
Don Quixote

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