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.
jblahaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jblahaAuthor Commented:
Here is a spreadsheet calculating the cells I would like the multistep way.
0
Glenn RayExcel VBA DeveloperCommented:
No attachment. :-/

Does your data resemble this layout?
layout
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
0
jblahaAuthor Commented:
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
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Rgonzo1971Commented:
Hi,

You could use an User Defined Function

Function fLifeExpectancy(rngData As Range) As Double
Set rwRange = rngData.Resize(1)
Set clRange = rngData.Offset(1, rngData.Columns.Count - 1).Resize(rngData.Rows.Count - 1, 1)
Set newRange = Union(clRange, rwRange)
Dim arrData()
ReDim arrData(newRange.Count - 1)
Idx = 0
For Each c In rwRange
    If Idx = 0 Then
        arrData(Idx) = 1 - c.Value / 1000
    Else
        arrData(Idx) = arrData(Idx - 1) * (1 - c.Value / 1000)
    End If
    Idx = Idx + 1
Next
For Each c In clRange
    arrData(Idx) = arrData(Idx - 1) * (1 - c.Value / 1000)
    Idx = Idx + 1
Next
fLifeExpectancy = WorksheetFunction.Sum(arrData)
End Function

Open in new window

Regards
Example-TableV1.xlsm
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Glenn RayExcel VBA DeveloperCommented:
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).
0
jblahaAuthor Commented:
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.
0
Glenn RayExcel VBA DeveloperCommented:
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
0
Rgonzo1971Commented:
Hi,

Since you insist for a formula

pls try as Array Formula (Ctrl-Shft-Enter) in Cell B6

=SUM(PRODUCT(1-D6:D6/1000),PRODUCT(1-D6:E6/1000),PRODUCT(1-D6:F6/1000),PRODUCT(1-D6:G6/1000),PRODUCT(1-D6:H6/1000),PRODUCT(1-D6:I6/1000),PRODUCT(1-D6:J6/1000),PRODUCT(1-D6:K6/1000),PRODUCT(1-D6:L6/1000),PRODUCT(1-D6:M6/1000),PRODUCT(1-D6:N6/1000),PRODUCT(1-D6:O6/1000),PRODUCT(1-D6:P6/1000),PRODUCT(1-D6:Q6/1000),PRODUCT(1-D6:R6/1000),PRODUCT(1-D6:S6/1000),PRODUCT(1-D6:T6/1000),PRODUCT(1-D6:U6/1000),PRODUCT(1-D6:V6/1000),PRODUCT(1-D6:W6/1000),PRODUCT(1-D6:X6/1000),PRODUCT(1-D6:Y6/1000),PRODUCT(1-D6:Z6/1000),PRODUCT(1-D6:AA6/1000),PRODUCT(1-D6:AB6/1000),PRODUCT(1-D6:AC6/1000),IF(ROW(AC7)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC7/1000),0),IF(ROW(AC8)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC8/1000),0),IF(ROW(AC9)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC9/1000),0),IF(ROW(AC10)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC10/1000),0),IF(ROW(AC11)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC11/1000),0),IF(ROW(AC12)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC12/1000),0),IF(ROW(AC13)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC13/1000),0),IF(ROW(AC14)<102,PRODUCT(1-D6:AC6/10
00,1-AC7:AC14/1000),0),IF(ROW(AC15)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC15/1000),0),IF(ROW(AC16)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC16/1000),0),IF(ROW(AC17)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC17/1000),0),IF(ROW(AC18)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC18/1000),0),IF(ROW(AC19)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC19/1000),0),IF(ROW(AC20)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC20/1000),0),IF(ROW(AC21)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC21/1000),0),IF(ROW(AC22)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC22/1000),0),IF(ROW(AC23)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC23/1000),0),IF(ROW(AC24)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC24/1000),0),IF(ROW(AC25)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC25/1000),0),IF(ROW(AC26)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC26/1000),0),IF(ROW(AC27)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC27/1000),0),IF(ROW(AC28)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC28/1000),0),IF(ROW(AC29)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC29/1000),0),IF(ROW(AC30)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC30/1000),0),IF(ROW(AC31)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC31/1000),
0),IF(ROW(AC32)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC32/1000),0),IF(ROW(AC33)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC33/1000),0),IF(ROW(AC34)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC34/1000),0),IF(ROW(AC35)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC35/1000),0),IF(ROW(AC36)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC36/1000),0),IF(ROW(AC37)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC37/1000),0),IF(ROW(AC38)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC38/1000),0),IF(ROW(AC39)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC39/1000),0),IF(ROW(AC40)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC40/1000),0),IF(ROW(AC41)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC41/1000),0),IF(ROW(AC42)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC42/1000),0),IF(ROW(AC43)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC43/1000),0),IF(ROW(AC44)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC44/1000),0),IF(ROW(AC45)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC45/1000),0),IF(ROW(AC46)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC46/1000),0),IF(ROW(AC47)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC47/1000),0),IF(ROW(AC48)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC48/1000),0),IF(ROW(AC49)<102,
PRODUCT(1-D6:AC6/1000,1-AC7:AC49/1000),0),IF(ROW(AC50)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC50/1000),0),IF(ROW(AC51)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC51/1000),0),IF(ROW(AC52)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC52/1000),0),IF(ROW(AC53)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC53/1000),0),IF(ROW(AC54)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC54/1000),0),IF(ROW(AC55)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC55/1000),0),IF(ROW(AC56)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC56/1000),0),IF(ROW(AC57)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC57/1000),0),IF(ROW(AC58)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC58/1000),0),IF(ROW(AC59)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC59/1000),0),IF(ROW(AC60)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC60/1000),0),IF(ROW(AC61)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC61/1000),0),IF(ROW(AC62)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC62/1000),0),IF(ROW(AC63)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC63/1000),0),IF(ROW(AC64)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC64/1000),0),IF(ROW(AC65)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC65/1000),0),IF(ROW(AC66)<102,PRODUCT(1-D6:AC6/100
0,1-AC7:AC66/1000),0),IF(ROW(AC67)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC67/1000),0),IF(ROW(AC68)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC68/1000),0),IF(ROW(AC69)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC69/1000),0),IF(ROW(AC70)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC70/1000),0),IF(ROW(AC71)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC71/1000),0),IF(ROW(AC72)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC72/1000),0),IF(ROW(AC73)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC73/1000),0),IF(ROW(AC74)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC74/1000),0),IF(ROW(AC75)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC75/1000),0),IF(ROW(AC76)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC76/1000),0),IF(ROW(AC77)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC77/1000),0),IF(ROW(AC78)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC78/1000),0),IF(ROW(AC79)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC79/1000),0),IF(ROW(AC80)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC80/1000),0),IF(ROW(AC81)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC81/1000),0),IF(ROW(AC82)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC82/1000),0),IF(ROW(AC83)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC83/1000),0
),IF(ROW(AC84)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC84/1000),0),IF(ROW(AC85)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC85/1000),0),IF(ROW(AC86)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC86/1000),0),IF(ROW(AC87)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC87/1000),0),IF(ROW(AC88)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC88/1000),0),IF(ROW(AC89)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC89/1000),0),IF(ROW(AC90)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC90/1000),0),IF(ROW(AC91)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC91/1000),0),IF(ROW(AC92)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC92/1000),0),IF(ROW(AC93)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC93/1000),0),IF(ROW(AC94)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC94/1000),0),IF(ROW(AC95)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC95/1000),0),IF(ROW(AC96)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC96/1000),0),IF(ROW(AC97)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC97/1000),0),IF(ROW(AC98)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC98/1000),0),IF(ROW(AC99)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC99/1000),0),IF(ROW(AC100)<102,PRODUCT(1-D6:AC6/1000,1-AC7:AC100/1000),0),IF(ROW(AC101)<10
2,PRODUCT(1-D6:AC6/1000,1-AC7:AC101/1000),0))


EDIT Corrected Formula and new File
Cheerio
Example-TableV3.xlsx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Spreadsheets

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.