How to convert a CSE to VBA?

rossn13

New Member
Joined
Jul 21, 2011
Messages
13
Hi there gurus!
I have the following array formula repeated a lot of times, and it's making my spreadsheets completely unusable :(

It would brilliant if somebody could explain how I'd go about converting it to VBA? Or even better if somebody could do it for me!?

I'd be eternally grateful :biggrin:

Code:
{=IF(ISERROR(INDEX(Fixtures!$E:$E,MATCH(S$3&$F7,Fixtures!$C:$C&Fixtures!$D:$D,0))),IF(ISERROR(INDEX(Fixtures!$D:$D,MATCH(S$3&$F7,Fixtures!$C:$C&Fixtures!$E:$E,0))),"",LOWER(INDEX(Fixtures!$D:$D,MATCH(S$3&$F7,Fixtures!$C:$C&Fixtures!$E:$E,0)))),UPPER(INDEX(Fixtures!$E:$E,MATCH(S$3&$F7,Fixtures!$C:$C&Fixtures!$D:$D,0))))}
ot2ert.png


Image is of fixtures worksheet.
 

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.
And the formula does what exactly?
 
Upvote 0
What do you mean by converting to VBA?

To add an array formula to a range, the syntax would be like
Code:
Range("G1:G10").FormulaArray = "=SUM(IF(A1:A10=3,5))"

To make the same calculation as an array formula, but using VBA instead, it is often easier to approach the problem ex novo. The Evaluate funcion can also be used.
 
Upvote 0
And the formula does what exactly?

Apologies, it's a bit ugly. Here's the other worksheet, it might make things a bit clearer.
It selects the opponents for the next match using the date and team as references. Could be a home or away game. Displays in caps if the game is at home and lower case if its away.

25i1500.png
 
Upvote 0
What do you mean by converting to VBA?

To add an array formula to a range, the syntax would be like
Code:
Range("G1:G10").FormulaArray = "=SUM(IF(A1:A10=3,5))"
To make the same calculation as an array formula, but using VBA instead, it is often easier to approach the problem ex novo. The Evaluate funcion can also be used.

I'm just after a much more efficient method than the array formula that I'm currently using. I've not delved much into VBA before (Other than simple macro editing) and wondered if it could be used in this case somehow?
 
Upvote 0
Sorry but this really isn't clear.

What are the 2 sheets called?

In the posted formula you refer to 'Fixtures'?

Which sheet is that?

Also where are you using the formula?
 
Upvote 0
Sorry but this really isn't clear.

What are the 2 sheets called?

In the posted formula you refer to 'Fixtures'?

Which sheet is that?

Also where are you using the formula?

Top worksheet is Fixtures, the formula is in the second worksheet (Team 1) cell F7. And copied to all the other cells in the "fixture grid" S7:AJ17
 
Last edited:
Upvote 0
I'm afraid I still don't get what's going on and it's kind of hard to check things based on images.

For example, in F7 of the first worksheet the result is QPRBol.

In the second worksheet F7 has Che (Chelsea?), and it's against the goalkeeper P (Petr) Cech.

Where's the connection?

Am I missing something completely obvious?

Can you upload the workbook and post a link?

PS You could try adjusting the current formulas to use more specific ranges instead of working withe entire columns.
 
Upvote 0
Here's the workbook:
http://www.filefactory.com/file/cde73e7/n/TFF_11-12_WIP.xlsm

Sorry if I'm being unclear!
F7 (players Club) in the second worksheet (Team 1) has to match either column D (home matches) or E (away matches) in the first (Fixtures), for each of the dates in row 3 (Team 1, second worksheet). In other words I'm extracting Chelsea's fixtures, both home and away, from a list of all the Premier League fixtures.

Thanks for helping btw Norie :)
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,634
Members
452,934
Latest member
Jdsonne31

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