Complex Excel Formula Question

JeffK627

Active Member
Joined
Jun 22, 2005
Messages
313
Hello All,

I have a seriously complex set of conditions that need to be represented in one cell in each row of a worksheet. Here's what I need to happen:

Rich (BB code):
If column D, Row x is		Column K, Row x needs to be
Category A		        Same as Column G, Row x
Category B		        Same as Column G, Row x
Category C		        Same as Column G, Row x
Category D		        Column F, Row x * AVG(Column I where Column D = Category C)
Category E		        ((AVG(Column I where Column D = Category C) * Column F, Row x) / (1-(AVG(Column I where Column D = Category C)))
Category F		        Same as Column G, Row x
Category G		        Column F, Row x * AVG(Column I where Column D = Category F)
Category H		        (Column F, Row x * AVG(Column I where Column D = Category F)) / (1-(AVG(Column I where Column D = Category F)))

Is there a way to do this without a ridiculous amount of ORs, IFs and COUNTIFs?

Thanks in advance!
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Here is one approach

=($K1 = CHOOSE(MATCH($D1,{"A","B","C","D"},0), $G1, $G1, $G1, $F1 * SUMPRODUCT($I$1:$I$999, --($D$1:$D999=$C$1:$C999))/SUMPRODUCT(--($D$1:$D999=$C$1:$C999))) )
 
Upvote 0
MATCH($D1,{"A","B","C","D"},0) returns 1,2,3 or 4 depending on what is in D1

CHOOSE(MATCH(...), ) reuturns the value g1, g1, g1 ,F1*(your average) depending on what is in D1

K1 = CHOOSE(...) tests if K1 matches those values

Thus what is in D1 determines the MATCH value. CHOOSE of that determines what value is going to be compared to K1.
 
Upvote 0
OK, actually, I ain't got it...

The problem is, depending on which of the categories is in Column D, I need to put a different formula in column K. The formula you gave me does that, but some of the formulas are "normal" (e.g. "=B1/C1") and some are array formulas. I can't use "K:K.FormulaArray=" before the CHOOSE, it throws an error (Unable to set the FormulaArray property of the Range class).

So - is there a way to use the same CHOOSE function to enter either a simple formula or an array formula in a cell?
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,134
Members
452,890
Latest member
Nikhil Ramesh

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