Link to home
Start Free TrialLog in
Avatar of jblaha
jblaha

asked on

Excel single cell calculation for the sum of a series of compounding products

I would like to calculate the sum of a series of compounding products in a single cell.  I can do this rather simply in excel by calculating the series of compounding products in a table, then summing each column of the resulting products.  However, I would like to do this in a single cell, and without any VBA.  Arrays would be fine.

The original data is organized as follows:

In a single row, there are multiple columns of fractions.  After the 25th colum of data, the data changes from being displayed in a single row to being displayed down the 26th column.  So the data is in a downward "L" shape in the table.  Assume the data is in ROW 1 from COLUMN A to COLUMN Z, then continuing down COLUMN Z to ROW 30.

To do the calcualtion in multiple steps, I would calculate the compounding products as follows in a single row below the table:

First, remove the "L" shape in the table by copying the table to a new location, and transposing the data in the 26th column and appending it to the end of the ROW 1.

Then in cell A40 calculate, (1-A1), then in B40 calculate A40*(1-B1), and drag that formula accross the row to the end of the columns containing data.

Then in cell A45 calculate SUM(A40:[end of columns with data]).  This is the final result I am looking for.

I woud like to calcualte all of this in a single cell and without having to "straighten out" the "L" shape in the original table.
Avatar of jblaha
jblaha

ASKER

Here is a spreadsheet calculating the cells I would like the multistep way.
Avatar of Glenn Ray
No attachment. :-/

Does your data resemble this layout?
User generated image
I'm restating your request to understand:
1) The values in column Z (Z1:Z30) should be transposed to Z1:BC1
2) Cell A40:  =1-A1
3) Cell B40: =A40*(1-B1), copied out to cell BC40
4) Cell A45: =SUM(A40:BC40)

Your goal is to derive the value shown in A45 without any of the transposition or intermediate formulas, correct?

-Glenn
Avatar of jblaha

ASKER

Glenn,

Thanks for looking into this.  I believe you have restated the request correctly.

I must have forgotten to click "upload file".  I hope this post will upload it.  The data in the attached is set up the same as I described, but has an entire table of the calculations to be performed that continue down each row instead of for just one.

Please let me know if you have any ideas on how to do this without all teh intermediate steps.

Thasnk,

John
Example-Table.xlsx
ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I thought about that also, but the requester asked for a non-VBA solution.

Frankly, I can't think of any other way to solve this.  I think it's possible that an exponential array function can do this, but it would be the sum of two array functions (to handle the range transposition).
Avatar of jblaha

ASKER

Rgonzo1971 Thanks for the suggestion.  Perhaps I can use that code as a backup, but I prefer not to use VBA if at all possible.

Glenn, Do you have a solution for calculating the data in a single cell if there is no kink in the table.  A half-way there solution would be for me to straighten out the table, but not have to do all the interim calcs.

What is getting me is how to get the formula to create a series of compounding products that it can then sum.  I can get the compounded number for any single column along the columns without calculating the prior columns by using an array formula such as:

{=PRODUCT(1-[DYNAMIC RANGE]/1000)}

Where [DYNAMIC RANGE] could be a cell range defined with $ signs or maybe using the OFFSET function.

But I can't get this to calculate all the prior compounded numbers in the prior columns and then sum them in that single cell.
I'm deferring to Rgonzo's solution; that's the cleanest way to go.  And it works very well (great coding, too).

The construction of the data in the first sheet makes it immensely difficult - if not impossible - to construct an array function to properly transpose into the compounding sum of products.  

Regards,
-Glenn
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial