How to consolidate a Large Formula

Grimm127

Board Regular
Joined
Aug 17, 2011
Messages
132
HI All you Gurus out there,

I need a bit of help. I am working on a report that I need to basically get a percentage of revenue. My formula is Dymanic using Index where I can drill down to the account and using a Indirect for the Tab based on the selection of Year.

Below is a formula that I need to sum the correct revenue. The Revenue I need to add at three segments Internal, External and Broker from the Whole. Is there a way I can make this smaller maybe making it into a function?

Another thought is I just create a Macro where it inserts the formula into the cell and then save as values....Thanks in advance for your suggestions.....

=SUMIFS(INDEX(INDIRECT("'"&$BR$3&"'!"&"$W:$AH"),0,N$6),INDIRECT("'"&$BR$3&"'!"&"$L:$L"),$B7,INDEX(INDIRECT("'"&$BR$3&"'!"&"$A:$N"),0,$BF$4),$BE$4,INDEX(INDIRECT("'"&$BR$3&"'!"&"$A:$N"),0,$BF$5),$BE$5,INDEX(INDIRECT("'"&$BR$3&"'!"&"$A:$N"),0,$BF$6),$BE$6,INDEX(INDIRECT("'"&$BR$3&"'!"&"$A:$N"),0,$BF$7),$BE$7,INDEX(INDIRECT("'"&$BR$3&"'!"&"$A:$N"),0,$BF$8),$BE$8)-SUMIFS(INDEX(INDIRECT("'"&$BR$3&"'!"&"$W:$AH"),0,N$6),INDIRECT("'"&$BR$3&"'!"&"$L:$L"),$B7,INDEX(INDIRECT("'"&$BR$3&"'!"&"$A:$N"),0,$BF$4),$BE$4,INDEX(INDIRECT("'"&$BR$3&"'!"&"$A:$N"),0,$BF$5),$BE$5,INDEX(INDIRECT("'"&$BR$3&"'!"&"$A:$N"),0,$BF$6),$BE$6,INDEX(INDIRECT("'"&$BR$3&"'!"&"$A:$N"),0,$BF$7),$BE$7,INDEX(INDIRECT("'"&$BR$3&"'!"&"$A:$N"),0,$BF$8),$BE$8,INDEX(INDIRECT("'"&$BR$3&"'!"&"$A:$N"),0,14),"Brk")+SUMIFS(INDEX(INDIRECT("'"&$BR$3&"'!"&"$W:$AH"),0,N$6),INDIRECT("'"&$BR$3&"'!"&"$L:$L"),$B8,INDEX(INDIRECT("'"&$BR$3&"'!"&"$A:$N"),0,$BF$4),$BE$4,INDEX(INDIRECT("'"&$BR$3&"'!"&"$A:$N"),0,$BF$5),$BE$5,INDEX(INDIRECT("'"&$BR$3&"'!"&"$A:$N"),0,$BF$6),$BE$6,INDEX(INDIRECT("'"&$BR$3&"'!"&"$A:$N"),0,$BF$7),$BE$7,INDEX(INDIRECT("'"&$BR$3&"'!"&"$A:$N"),0,$BF$8),$BE$8)
 
You can't use a Name for a range that can be confused for a cell reference.
? I knew I was overlooking something ridiculously obvious.

After Kirk mentioned problems I tried the formula, but only with rng, not rng1, etc. Had I done so I would have realised the error in my suggestion.
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Here is a mock up of the approach if it might be of some use:
Grimm127.xlsx
ABCGHMNOPBDBEBFBGBR
1rngAINDIRECT("'"&$BR$3&"'!"&"$A:$N")
2rngBINDIRECT("'"&$BR$3&"'!"&"$W:$AH")Sheet Name
3rngCINDIRECT("'"&$BR$3&"'!"&"$L:$L")valcolSheet 27
4formula ->290.1rngA filter ->161
5colrngA filter ->172
6val2<- rngB filterrngA filter ->183
7rngC filter ->11rngA filter ->194
8rngC filter ->13rngA filter ->205
Grimm127
Cell Formulas
RangeFormula
B4B4=SUM(SUMIFS(INDEX(rngB,0,N$6),rngC,$B7:$B8,INDEX(rngA,0,$BF$4),$BE$4,INDEX(rngA,0,$BF$5),$BE$5,INDEX(rngA,0,$BF$6),$BE$6,INDEX(rngA,0,$BF$7),$BE$7,INDEX(rngA,0,$BF$8),$BE$8,INDEX(rngA,0,14),{"<>Brk";"<>"}))
Press CTRL+SHIFT+ENTER to enter array formulas surrounded with curly braces.

And the worksheet referenced in BR3 with some random data, where I've been checking functionality with rows 6,7,11, and 12:
Grimm127.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAH
1rngArngCrngB
21234567891011121314123456789101112
3111111111111111357911131517192123
4444444444444441357911131517192123
5555555555555551357911131517192123
61617181920313131111Brk115557911131517192123
71617181920222222112213.157911131517192123
8333333333333331357911131517192123
9666666666666661357911131517192123
10999999999999991357911131517192123
111617181920313131131Brk18857911131517192123
121617181920313131131999119957911131517192123
13313131313131311357911131517192123
14131313131313131357911131517192123
15313131313131311357911131517192123
16
17
Sheet 27
 
Upvote 0

Forum statistics

Threads
1,215,065
Messages
6,122,944
Members
449,095
Latest member
nmaske

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