OFFSET MATCH SUM - summing cash flows

jdmc45

Board Regular
Joined
May 8, 2011
Messages
146
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have some columns and rows of cash flows, so from columns A to F I have Cashflow 1, Cashflow2, ... Cashflow 6, and down to row 100 say. I would like to sum these cash flows, say in column Z. The problem is in later datasets the number of columns of cash flows could change, it could only be columns A to C with Cashflow 1, Cashflow 2, Cashflow 3 or it could be columns A to K with 11 cashflows, etc. How would I use an offset match and sum to sum the whole row of cash flows given that the header has the word "Cashflow" in it?

Thanks
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Posting a tiny sample would be helpful.

Code:
A     B      C        D
$1    $4    $5       $5

want to sum this row, and all subsequent rows, based on the number of columns. The number of columns could increase or decrease, but all will be labelled as CF, column A CF1, column B CF2 etc.

How do I sum each row based on the number of columns, which is variable?

I came up with something like

Code:
=SUM(OFFSET(A1,ROWS($A$2:A2),0,1,MATCH("CF",LEFT(1:1,2),0)))

but LEFT doesn't work on arrays
 
Upvote 0
The first code segment are the cash flows. with the dollar signs in front of them.

I'm sorry I don't understand: You also posted a formula where you match "CF" against 1:1. The tiny sample you posted does not contain anything displaying "CF". Your data and its lay-out probably appears obvious to you, but, at least, not to me. Hence the request for a tiny sample.
 
Upvote 0
I'm sorry I don't understand: You also posted a formula where you match "CF" against 1:1. The tiny sample you posted does not contain anything displaying "CF". Your data and its lay-out probably appears obvious to you, but, at least, not to me. Hence the request for a tiny sample.
Code:
A         B            C                D                E                F
ID       Code       CF1            CF2              CF3             CF4
1234     AU         -20          10                 15                 20
1345     BK         -547        24                42                36

Hope that helps
 
Upvote 0
Great. Could you also specify the desired result per ID if it's not just sum CF values as in:

In Z2 enter:

=SUMIF($C$1:$Y$1,"CF*",C2:Y2)
 
Upvote 0
if you still wants offset function to work

try this
in cell Z2

=SUM(OFFSET(C2,,,,COUNT(C2:Y2)))
Data start from c2 to y2
 
Upvote 0
if you still wants offset function to work

try this
in cell Z2

=SUM(OFFSET(C2,,,,COUNT(C2:Y2)))
Data start from c2 to y2

Thank you for your solution. Also, thankyou Aladin as yours works too. I think I understand your formula Aladin, your formula looks for CF in any of the cells in the row specified and if CF does appear (by using the *) then it will sum the cash flows.

Anandvarma I have no idea how your formula works. Do you mind explaining it to me? Cheers!
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,753
Members
452,940
Latest member
rootytrip

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