Formula too long for macro?

BuddJ

New Member
Joined
Apr 14, 2016
Messages
42
Hia,

I have the following formula, which works when entered into a cell directly, but when I attempt to include it in a macro the text turns red & is not accepted. Unfortunately there is no error message displayed so I don't even have a starter to hit google with, so I'm assuming that at 1021 characters it's possibly too long for a macro ??

The cell formula is :-
Code:
=SUM(((((COUNTIFS('Staff List'!$B:$B,$A3,'Staff List'!AI:AI,""Match*""))+(<wbr>COUNTIFS('Staff List'!$B:$B,$A3,'Staff List'!AI:AI,""Expiring*""))+(COUNTIFS('Staff List'!$B:$B,$A3,'Staff List'!AJ:AJ,""Match*""))+(COUNTIFS('Staff List'!$B:$B,$A3,'Staff List'!AJ:AJ,""Expiring*""))+(COUNTIFS('Staff List'!$B:$B,$A3,'Staff List'!AK:AK,""Match*""))+(COUNTIFS('Staff List'!$B:$B,$A3,'Staff List'!AK:AK,""Expiring*""))))/(((COUNTIFS('Staff List'!$B:$B,$A3,'Staff List'!AI:AI,""Match*""))+(COUNTIFS('Staff List'!$B:$B,$A3,'Staff List'!AI:AI,""Expiring*"")+(COUNTIFS('Staff List'!$B:$B,$A3,'Staff List'!AI:AI,""Required*""))+(COUNTIFS('Staff List'!$B:$B,$A3,'Staff List'!AJ:AJ,""Match*""))+(COUNTIFS('Staff List'!$B:$B,$A3,'Staff List'!AJ:AJ,""Expiring*"")+(COUNTIFS('Staff List'!$B:$B,$A3,'Staff List'!AJ:AJ,""Required*""))+(COUNTIFS('Staff List'!$B:$B,$A3,'Staff List'!AK:AK,""Match*""))+(COUNTIFS('Staff List'!$B:$B,$A3,'Staff List'!AK:AK,""Expiring*"")+(COUNTIFS('Staff List'!$B:$B,$A3,'Staff List'!AK:AK,""Required*""))))))))*100)
<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>

The idea behind the formula is :-
- There are 3 columns of data on the worksheet "Staff List" with the calculation result appearing on another worksheet hence the sheet reference.
- Each column contains text data in the cells with the form of "Required", "Expiring", "Match","Not Required"
- I need to count the number of cells containing "Expiring" & "Match" across all three columns
- I then need to divide the above total with a count, also across all 3 columns, of the cells containing "Required", "Expiring" & "Match"
- Multiply by 100 to get a % value

Is there perhaps a more elegant way to achieve the same result ??

Many thanks for any assistance, tips or pointers.
 
Last edited:

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
If you're going to go with a vba solution, I would go with a custom function. Within it, for example, you could have separate variables for each of the countifs on separate lines, then combine them to produce your final result. This would be much easier to see and to troubleshoot.
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,237
Members
448,555
Latest member
RobertJones1986

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