Help me minimize this formula

Eraengineer

Board Regular
Joined
Jun 12, 2011
Messages
226
I get the character limit error(unable to set the formula array of the range class) when running applying this array in vba....I am a little stummped on how to shrink it down to make it usable in vba. Any help would be greatly appreciated.

Range("Table10[Work Center]").FormulaArray = _
"=IFERROR(INDEX(Table9[Work Center], SMALL(IF(($A$4=Table9[Department])*(COUNTIF($A$6:A6, Table9[Work Center])=0), ROW(Table9[Department])-MIN(ROW(Table9[Department]))+1, ""), 1)), "")"
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Although I do believe I am under the 255 max characters for this error to be tripped 231 to be exact....
 
Upvote 0
Although I do believe I am under the 255 max characters for this error to be tripped 231 to be exact....
Then logically the problem is not because it's too long..

It's probably the quotes.
You have to double up quotes when entering a formula with VBA.
[Department]))+1, ""), 1)), "")"
would be
[Department]))+1, """"), 1)), """")"
 
Upvote 0
You haven't met the character limit. You're missing quotation marks. For both sets of "" in the formula, you need to double them up so the end of your formula looks like this:
+1, """"), 1)), """")"
Every quote used inside a quoted string must be doubled.
 
Upvote 0
I tried that and I even removed the quotes and replace them with numbers to remove that issue altogether and no success....
 
Upvote 0
VBA wasn't liking this Range("Table10[Work Center]").FormulaArray so I called out a cell and it worked. Weird that you cannot call out the entire table but I guess it updates all the rows anyway....
 
Upvote 0
I see the problem..

You can't put multicell array formulas in a Table.
this line is telling VBA to put the formula in ALL cells within the Work Center column of the table..
Range("Table10[Work Center]").FormulaArray =

You'll have to put it in the first cell of the column, then fill down.
 
Upvote 0
I am having issues with the fill down.... Excel will not let you paste the arrays in the table either... I need to fill down to the end of the table.
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

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