255 character limit with VBA array formula

solti

Board Regular
Joined
May 15, 2015
Messages
52
I have a problem with 255 character limit with VBA array formula. I split my code into 2 sets of functions but doing it wrong. Could you please help
Code:
[/FONT][/COLOR][COLOR=#006600][FONT=Courier]Dim Index1 As String [/FONT][/COLOR]
[COLOR=#006600][FONT=Courier]Dim Index2 As String [/FONT][/COLOR]

[COLOR=#006600][FONT=Courier]Index1 = "=INDEX('LISTA'!R20C2:R2000C2000, MATCH(""Pła"",'LISTA'!R20C1:R2000C1,0),MATCH(R[]C2&R[]C3,'LISTA'!R17C2:R17C2000&'LISTA'!R13C2:R13C2000,0))"[/FONT][/COLOR]

[COLOR=#006600][FONT=Courier]Index2 = "=INDEX('LISTA'!R20C2:R2000C2000, MATCH( ""Hon"",'LISTA'!R20C1:R2000C1,0),MATCH(R[]C2&R[]C3,'LISTA'!R17C2:R17C2000&'LISTA'!R13C2:R13C2000,0))" [/FONT][/COLOR]
[COLOR=#006600][FONT=Courier]                [/FONT][/COLOR]
[COLOR=#006600][FONT=Courier].Cells(i, 13).FormulaArray = Application.WorksheetFunction.Sum(Index1, Index2) 
[/FONT][/COLOR][COLOR=#212121][FONT=arial]
****** id="cke_pastebin" style="position: absolute; top: 0px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">
Code:
have a problem with 255 character limit with VBA array formula. I crashed into memory but did not work
</body>
 
Hi

Following the idea in Post#4 by @DushiPanda try inserting the problematic MATCH into a vacant column on the same row (13) :-
Code:
.Cells(i, nn).FormulaArray = "=MATCH(RC2&RC3,lista!R17C2:R17C2000&lista!R13C2:R13C2000,0)"
where nn is the vacant column.

Then each of your formulae becomes :-
Code:
Index1 = Evaluate("INDEX(lista!R20C2:R2000C2000,MATCH(""Pła"",lista!R20C1:R2000C1,0),RCnn)")
 Index2 = Evaluate("INDEX(lista!R20C2:R2000C2000,MATCH(""Hon"",lista!R20C1:R2000C1,0),RCnn)")
where nn is the vacant column.

and your result is :-
Code:
.Cells(i, 13).Value = Index1 + Index2

hth
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
When you get your Application.WorksheetFunction.Index/.Match working, there are a couple options you can do, I would suggest the following:

Index1 = Application.WorksheetFunction.Index/.Match#1
Index2 = Application.WorksheetFunction.Index/.Match#2

.Cells(i, 13).Value = Index1 + Index2

You can send me an example file (suggest dropbox.com). I'm at work right now so I won't be able to download it and have a look at it until I'm not at work.

Alternatively, you can use two unused cells to do something like so:
Code:
Index1 = "=INDEX(lista!R20C2:R2000C2000,MATCH(""Pła"",lista!R20C1:R2000C1,0),MATCH(RC2&RC3,lista!R17C2:R17C2000&lista!R13C2:R13C2000,0))"
Index2 = "=INDEX(lista!R20C2:R2000C2000,MATCH(""Hon"",lista!R20C1:R2000C1,0),MATCH(RC2&RC3,lista!R17C2:R17C2000&lista!R13C2:R13C2000,0))"

.Cells(i, 75).FormulaArray = Index1
.Cells(i, 76).FormulaArray = Index2

.Cells(i, 13).Value = .Cells(i, 75).Value + .Cells(i, 76).Value

.Cells(i, 75).ClearContents
.Cells(i, 76).ClearContents



GENIUS !!!!!!!!!!!!!!!!!!
Thanks a lot, working. I owe you big beer !!!!!!!!!!!!!!!! (y)(y)
 
Upvote 0

Forum statistics

Threads
1,215,236
Messages
6,123,799
Members
449,127
Latest member
Cyko

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