SUMIFS using Dictionary

inactiveUser462638

New Member
Joined
Jun 13, 2020
Messages
13
Office Version
  1. 2016
Platform
  1. Windows
Hi Excel Champs,

Please help me getting this calculated. I'm using SUMIFS formulas now but it's going very slow.

I have data like this:

Element TypeInflow/OutflowForecast IDElement DescriptionDateRecording PersonVendor / CustomerGross Amount
HR CostsOutflowRefund Andre01.01.2020PhilCustomer118.00
Technology ServicesOutflowSubscription01.01.2020PhilCustomer245.00
Loans and TaxesInflowSubscription01.02.2020PhilCustomer245.00
Office CostsOutflowSubscription01.03.2020PhilCustomer236.00
Travel, Accommodation, ExpensesOutflowIncome Tax01.04.2020PhilCustomer31337.79
Technology ServicesInflowSubscription01.04.2020PhilCustomer236.00
Loans and TaxesOutflowTo Customer401.05.2020PhilCustomer40.00
Loans and TaxesInflowSubscription01.05.2020PhilCustomer236.00

I need to make a CashFlow report out of above data like this:


DateBeginning BalanceCash InflowsCash OutflowsNet Cash FlowsEnding Cash Balance
01.01.2020100000=SUMIF()=SUMIF()=C2-D2=B2+E2
02.01.2020=F2=SUMIF()=SUMIF()=C3-D3=B3+E3
03.01.2020=F3=SUMIF()=SUMIF()=C4-D4=B4+E4

Can you please help me with a VBA code that calculates this using the Dictionary?

Thank you very much!
 
Last edited by a moderator:

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hi and welcome to MrExcel.

Yes it is possible to do the VBA code.
But I would have to assume all the calculations.
You could put a sample of your data and a sample of your result, using XL2BB tool, look at my signature.

Do you want to get these results on the same sheet or on another sheet?
Do you want to get them by pressing a button?
How many records do you have on your base sheet?
 
Upvote 0
Hello and thanks for your fast response!

I want to get the results on another sheet.
It will be by pressing a button or running the macro. (I know how to do that)

Let me give you an example of something similar that I found here:

Sumifs VBA with multiple criteria in multiple cells
Marcelo Branco's code was amazing and ran pretty fast but I did not understand how to make it to feet my data.

Thanks for your support.
 
Upvote 0
I used XL2BB to show you how my - Forecast Elements Sheet looks like and in the second one - Calculation Sheet - how my results should be:

CashFlow Planning 2020 - Automation Workbook.xlsx
ABCDEFGHIJKLMN
1Element TypeInflow/OutflowForecast IDElement DescriptionDateRecording PersonVendor / CustomerGross AmountPaying EntityID CountDate ValidatorCost Type Payment StatusPayment to NGI RO
21HR CostsOutflowSome company02.01.2020PhilSome company40.00UKRecurring DDPaidN/A
22HR CostsOutflowSome company02.01.2020PhilSome company39.00RORecurringPaid02/12/2019
23HR CostsInflowRefund for Canceled Flights02.01.2020PhilSome company111.50UKOne Time PaymentPaidN/A
24HR CostsOutflowSome company02.02.2020PhilSome company39.00UKRecurring DDPaid
25HR CostsOutflowSome company02.03.2020PhilSome company39.00UKRecurring DDPaidN/A
26HR CostsOutflowSome company02.03.2020PhilSome company33.00RORecurringPaid03/03/2020
27HR CostsOutflowService Charge02.03.2020PhilSome company34.00UKRecurring DDPaidN/A
28HR CostsOutflowSome company02.03.2020PhilSome company9.00RORecurringPaid03/03/2020
29HR CostsOutflowSome company02.04.2020PhilSome company39.00UKRecurring DDPaidN/A
30HR CostsOutflowSome company02.05.2020PhilSome company39.00UKRecurring DDPaidN/A
31HR CostsInflowSome company02.05.2020PhilSome company119666.80UKRecurringPaidN/A
32HR CostsOutflowSome company02.06.2020PhilSome company39.00UKRecurring DD
Forecast Elements
Cell Formulas
RangeFormula
H31H31=119666.8




CashFlow Planning 2020 - Automation Workbook.xlsx
ABCDEF
1DateBeginning BalanceCash InflowsCash OutflowsNet Cash FlowsEnding Cash Balance
201.01.2020100000=C2-D2=B2+E2
302.01.2020=F2=C3-D3=B3+E3
403.01.2020=F3=C4-D4=B4+E4
Calculation Sheet
Cell Formulas
RangeFormula
E2:E4E2=C2-D2
F2:F4F2=B2+E2
B3:B4B3=F2
 
Last edited by a moderator:
Upvote 0

But I'm interested in seeing the sumif formulas.
Your results Calculation Sheet is empty.
Could you give more examples on your sheet "Calculation Sheet"
Answer this: How many records do you have on your sheet "Forecast Elements"
 
Upvote 0
Hello @DanteAmor!

We have like 1000 records now but we use that in multiple sheets with multiple formulas.

That's how the formula is looking like now but I have to transpose the data as presented below:

CashFlow Planning 2020 - Automation Workbook Final.xlsm
ABCDEFGH
42Cash Flow Overview June2020/06/012020/06/022020/06/032020/06/042020/06/052020/06/062020/06/07
43Beginning Balance£120,000.00£120,000.00£120,000.00£120,000.00£120,000.00£120,000.00£120,000.00
44Cash Inflows£0.00£0.00£0.00£0.00£0.00£0.00£0.00
45Cash Outflows£0.00£0.00£0.00£0.00£0.00£0.00£0.00
46Net Cash Flows£0.00£0.00£0.00£0.00£0.00£0.00£0.00
47 Ending Cash Balance £120,000.00£120,000.00£120,000.00£120,000.00£120,000.00£120,000.00£120,000.00
DailyCashFlow Planning
Cell Formulas
RangeFormula
C43:H43C43=B47
B44:H44B44=SUMIFS('Forecast Elements'!$F2:$F1000,'Forecast Elements'!$C2:$C1000,"Inflow",'Forecast Elements'!$B2:$B1000,'DailyCashFlow Planning'!B42)
B45:H45B45=SUMIFS('Forecast Elements'!$F2:$F1000,'Forecast Elements'!$C2:$C1000,"Outflow",'Forecast Elements'!$B2:$B1000,'DailyCashFlow Planning'!B42)
B46:H46B46=B44-B45
B47:H47B47=B43+B46
 
Upvote 0
Hello @DanteAmor,

It seems that the formulas are not pretty accurate. That should be the SUMIF function for the Cash Inflow Column =SUMIFS('Forecast Elements'!$H2:$H1000,'Forecast Elements'!$B2:$B1000,"Inflow",'Forecast Elements'!$E2:$E1000,'DailyCashFlow Planning'!G84)
 
Upvote 0
I'm very confused.
In which sheet do you want the results, in "DailyCashFlow Planning" or "Calculation Sheet"?
Do you really want the results in cell A43?

Are the values in cells B43, C43, D43 ... fixed?

just show the examples of what you already have, do not reconstruct formulas or examples.
 
Upvote 0
I want the results in the Calculation Sheet.



I have to check the date and if it's inflow or outflow and to sum up the values from the Gross Amount Column. The cash flow will be for every day.







That is the Sheet from where I'm taking the data:







CashFlow Planning 2021.xlsx
ABCDEFGHILMN
1Inflow/OutflowElement TypeForecast IDCost DescriptionDateRecording PersonVendor / CustomerGross AmountPaying EntityCost Type Payment StatusPayment to Someone
2OutflowTechnology ServicesSome company2021/01/01PhilSome company 40 UKRecurring DDN/A
3OutflowTechnology ServicesQA Software2021/01/01PhilSome company 91 UKRecurring DD
4OutflowLoans and TaxesSome company2021/01/02PhilSome company 39 UKRecurring DD
5InflowLoans and TaxesSome company2021/01/02PhilSome company 39 UKRecurring DD
6OutflowOffice CostsSome company2021/01/02PhilSome company 39 RORecurring
7OutflowTechnology ServicesSome company2021/01/06PhilSome company 850 UKRecurring DD
8OutflowLoans and TaxesCorporate Premium Plan Fee2021/01/01PhilSome company 100 UKRecurring DDN/A
9OutflowTechnology ServicesSome company2021/01/06PhilSome company UK 120 UKRecurring DD
10InflowTechnology ServicesSome company2021/01/06PhilSome company UK 120 UKRecurring DD
Forecast Elements












And that the sheet where I need my results:







CashFlow Planning 2020 - Automation Workbook Final.xlsm
ABCDEF
1DateBeginning BalanceCash InflowsCash OutflowsNet Cash Flows Ending Cash Balance
201.01.2020£100,000.0000£0.00£100,000.00
302.01.2020£100,000.0000£0.00£100,000.00
Calculation Sheet Final Form
Cell Formulas
RangeFormula
C2:C3C2=SUMIFS('Forecast Elements'!$H:$H,'Forecast Elements'!$A:$A,"Outflow",'Forecast Elements'!$E:$E,A2)
D2:D3D2=SUMIFS('Forecast Elements'!$H:$H,'Forecast Elements'!$A:$A,"Outflow",'Forecast Elements'!$E:$E,A2)
E2:E3E2=C2-D2
F2:F3F2=B2+E2
B3B3=F2
 
Last edited by a moderator:
Upvote 0
=SUMIFS('Forecast Elements'!$H:$H,'Forecast Elements'!$A:$A,"Outflow",'Forecast Elements'!$E:$E,A2)
=SUMIFS('Forecast Elements'!$H:$H,'Forecast Elements'!$A:$A,"Outflow",'Forecast Elements'!$E:$E,A2)

Your 2 sumif formulas are the same, but I suppose one is Inflow and the other is Outflow.

=SUMIFS('Forecast Elements'!$H2:$H1000,'Forecast Elements'!$B2:$B1000,"Inflow",'Forecast Elements'!$E2:$E1000,'DailyCashFlow Planning'!G84)

I don't understand why so many changes in the formula.
Could you confirm if I take the structures of the sheets as final from post #9?
 
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,191
Members
453,021
Latest member
pingpong7117

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