Using an array formula in a macro, not working

wnorbury

New Member
Joined
Mar 8, 2017
Messages
1
Hi I am trying to use an array formula where I need to use cse to make the formula work,
This works when entered manually into a cell however I am trying to use in a macro and keep getting errors.

The formula is
IFERROR(INDEX(MyList,MAX(IF(ISERROR(SEARCH(MyList,T24),-1,1)*(ROW(MyList)-ROW(A$1$)+1))),""No Match"")
However in my macro I have.
Selection.FormulaArray = "=IFERROR(INDEX(MyList,MAX(IF(ISERROR(SEARCH(MyList,T24),-1,1)*(ROW(MyList)-ROW(A$1$)+1))),""No Match"")"

It is looking at a list with a defined name MyList and then in data held in column T. The response is then added to the relevant cell in column H.

There is another problem however as this needs to only work in cells that are blank when column H is filtered for blank cells, where I have T24 in the formula this is a manual entry but is there also a way to have this auto populate from the row it is entered into?
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Welcome to the board.

I can't even enter the original formula you say works
You have too many arguments in the ISERROR function.
You need one more )

And you have a typo in ROW(A$1$), I assume that's supposed to be $A$1

And you don't use double quotes in the actual cell formula (only in the vba code)

IFERROR(INDEX(MyList,MAX(IF(ISERROR(SEARCH(MyList,T24),-1,1)*(ROW(MyList)-ROW(A$1$)+1))),""No Match"")
Should be
IFERROR(INDEX(MyList,MAX(IF(ISERROR(SEARCH(MyList,T24)),-1,1)*(ROW(MyList)-ROW($A$1)+1))),"No Match")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,793
Messages
6,121,619
Members
449,039
Latest member
Mbone Mathonsi

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