Ratio calculation

tigerzen

Board Regular
Joined
Mar 8, 2023
Messages
165
Office Version
  1. 365
Platform
  1. Windows
Need a formula/function for Excel 2019 that calculates the ratio of money movements per each ending week. So for the first period we have a total of $12 coming in and $40 going out so the ratio for that week would be 12/40 which is 0.375. For the week ending 25th Aug we have $110 in and $60 going out so the ratio would be 110/60 which is 1.83

Book3
ABCDE
2Week endingClientCategoryMoney movementRatio calc
322-Sep-23SallyREF in$12
422-Sep-23JackREF out-$40
58-Sep-23BertREF out-$90
68-Sep-23TomREF out-$30
725-Aug-23BertREF in$30
825-Aug-23MaryREF out$60
925-Aug-23MaryREF in$80
104-Aug-23TomREF in$83
114-Aug-23TomREF in$14
124-Aug-23SallyREF out-$47
1314-Jul-23SallyREF in$1
1414-Jul-23JackREF out-$63
1530-Jun-23BertREF in$43
1630-Jun-23TomREF out-$30
1716-Jun-23SallyREF in$31
1816-Jun-23BertREF in$1
1916-Jun-23JackREF in$47
2026-May-23JackREF in$96
2126-May-23SallyREF in$85
2226-May-23JackREF out-$95
2326-May-23BertREF in$30
2428-Apr-23BertREF out-$52
2528-Apr-23JackREF in$93
2614-Apr-23SallyREF out-$68
2714-Apr-23SallyREF in$74
2814-Apr-23SallyREF out-$91
2914-Apr-23BertREF in$95
3017-Mar-23SallyREF out-$83
Sheet1
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Something like this maybe? You haven't said what you want done with weeks with only outs, or ins?

Book1
ABCDE
1Week endingClientCategoryMoney movementRatio calc
222-Sep-23SallyREF in$120.300
322-Sep-23JackREF out-$400.300
48-Sep-23BertREF out-$900.000
58-Sep-23TomREF out-$300.000
625-Aug-23BertREF in$301.833
725-Aug-23MaryREF out$601.833
825-Aug-23MaryREF in$801.833
94-Aug-23TomREF in$832.064
104-Aug-23TomREF in$142.064
114-Aug-23SallyREF out-$472.064
1214-Jul-23SallyREF in$10.016
1314-Jul-23JackREF out-$630.016
1430-Jun-23BertREF in$431.433
1530-Jun-23TomREF out-$301.433
1616-Jun-23SallyREF in$310.000
1716-Jun-23BertREF in$10.000
1816-Jun-23JackREF in$470.000
1926-May-23JackREF in$962.221
2026-May-23SallyREF in$852.221
2126-May-23JackREF out-$952.221
2226-May-23BertREF in$302.221
2328-Apr-23BertREF out-$521.788
2428-Apr-23JackREF in$931.788
2514-Apr-23SallyREF out-$681.063
2614-Apr-23SallyREF in$741.063
2714-Apr-23SallyREF out-$911.063
2814-Apr-23BertREF in$951.063
2917-Mar-23SallyREF out-$830.000
Sheet1
Cell Formulas
RangeFormula
E2:E29E2=IFERROR(SUMIFS(D:D,A:A,A2,C:C,"*in*")/ABS(SUMIFS(D:D,A:A,A2,C:C,"*out*")),0)
 
Upvote 0
Solution
Something like this maybe? You haven't said what you want done with weeks with only outs, or ins?

Book1
ABCDE
1Week endingClientCategoryMoney movementRatio calc
222-Sep-23SallyREF in$120.300
322-Sep-23JackREF out-$400.300
48-Sep-23BertREF out-$900.000
58-Sep-23TomREF out-$300.000
625-Aug-23BertREF in$301.833
725-Aug-23MaryREF out$601.833
825-Aug-23MaryREF in$801.833
94-Aug-23TomREF in$832.064
104-Aug-23TomREF in$142.064
114-Aug-23SallyREF out-$472.064
1214-Jul-23SallyREF in$10.016
1314-Jul-23JackREF out-$630.016
1430-Jun-23BertREF in$431.433
1530-Jun-23TomREF out-$301.433
1616-Jun-23SallyREF in$310.000
1716-Jun-23BertREF in$10.000
1816-Jun-23JackREF in$470.000
1926-May-23JackREF in$962.221
2026-May-23SallyREF in$852.221
2126-May-23JackREF out-$952.221
2226-May-23BertREF in$302.221
2328-Apr-23BertREF out-$521.788
2428-Apr-23JackREF in$931.788
2514-Apr-23SallyREF out-$681.063
2614-Apr-23SallyREF in$741.063
2714-Apr-23SallyREF out-$911.063
2814-Apr-23BertREF in$951.063
2917-Mar-23SallyREF out-$830.000
Sheet1
Cell Formulas
RangeFormula
E2:E29E2=IFERROR(SUMIFS(D:D,A:A,A2,C:C,"*in*")/ABS(SUMIFS(D:D,A:A,A2,C:C,"*out*")),0)
 
Upvote 0
Thanks Kevin, your formula works beautifully and yes you're right I omitted to mention that we need a summary by week so it should read 22 Sep 2023 0.3, 8 Sep 2023 0, 25 Aug 2023 1.83 etc, so in other words every unique week needs a ratio calculation. It can be done with a helper column, although I could just use filters or remove duplicates. It would be better though if we could come up with a dynamic formula to calculate this.
 
Upvote 0
we need a summary by week so it should read 22 Sep 2023 0.3
Like this maybe?
Book1
ABCDE
1Week endingClientCategoryMoney movementRatio calc
222-Sep-23SallyREF in1222 Sep 2023 0.300
322-Sep-23JackREF out-40 
48-Sep-23BertREF out-9008 Sep 2023 0.000
58-Sep-23TomREF out-30 
625-Aug-23BertREF in3025 Aug 2023 1.833
725-Aug-23MaryREF out60 
825-Aug-23MaryREF in80 
94-Aug-23TomREF in8304 Aug 2023 2.064
104-Aug-23TomREF in14 
114-Aug-23SallyREF out-47 
1214-Jul-23SallyREF in114 Jul 2023 0.016
1314-Jul-23JackREF out-63 
1430-Jun-23BertREF in4330 Jun 2023 1.433
1530-Jun-23TomREF out-30 
1616-Jun-23SallyREF in3116 Jun 2023 0.000
1716-Jun-23BertREF in1 
1816-Jun-23JackREF in47 
1926-May-23JackREF in9626 May 2023 2.221
2026-May-23SallyREF in85 
2126-May-23JackREF out-95 
2226-May-23BertREF in30 
2328-Apr-23BertREF out-5228 Apr 2023 1.788
2428-Apr-23JackREF in93 
2514-Apr-23SallyREF out-6814 Apr 2023 1.063
2614-Apr-23SallyREF in74 
2714-Apr-23SallyREF out-91 
2814-Apr-23BertREF in95 
2917-Mar-23SallyREF out-8317 Mar 2023 0.000
Sheet1
Cell Formulas
RangeFormula
E2:E29E2=IF(A2<>A1,TEXT(A2,"dd mmm yyyy ")&TEXT(IFERROR(SUMIFS(D:D,A:A,A2,C:C,"*in*")/ABS(SUMIFS(D:D,A:A,A2,C:C,"*out*")),0),"0.000"),"")
 
Upvote 0
Like this maybe?
Book1
ABCDE
1Week endingClientCategoryMoney movementRatio calc
222-Sep-23SallyREF in1222 Sep 2023 0.300
322-Sep-23JackREF out-40 
48-Sep-23BertREF out-9008 Sep 2023 0.000
58-Sep-23TomREF out-30 
625-Aug-23BertREF in3025 Aug 2023 1.833
725-Aug-23MaryREF out60 
825-Aug-23MaryREF in80 
94-Aug-23TomREF in8304 Aug 2023 2.064
104-Aug-23TomREF in14 
114-Aug-23SallyREF out-47 
1214-Jul-23SallyREF in114 Jul 2023 0.016
1314-Jul-23JackREF out-63 
1430-Jun-23BertREF in4330 Jun 2023 1.433
1530-Jun-23TomREF out-30 
1616-Jun-23SallyREF in3116 Jun 2023 0.000
1716-Jun-23BertREF in1 
1816-Jun-23JackREF in47 
1926-May-23JackREF in9626 May 2023 2.221
2026-May-23SallyREF in85 
2126-May-23JackREF out-95 
2226-May-23BertREF in30 
2328-Apr-23BertREF out-5228 Apr 2023 1.788
2428-Apr-23JackREF in93 
2514-Apr-23SallyREF out-6814 Apr 2023 1.063
2614-Apr-23SallyREF in74 
2714-Apr-23SallyREF out-91 
2814-Apr-23BertREF in95 
2917-Mar-23SallyREF out-8317 Mar 2023 0.000
Sheet1
Cell Formulas
RangeFormula
E2:E29E2=IF(A2<>A1,TEXT(A2,"dd mmm yyyy ")&TEXT(IFERROR(SUMIFS(D:D,A:A,A2,C:C,"*in*")/ABS(SUMIFS(D:D,A:A,A2,C:C,"*out*")),0),"0.000"),"")
Thanks Kevin, that will work great.
 
Upvote 0

Forum statistics

Threads
1,215,212
Messages
6,123,649
Members
449,111
Latest member
ghennedy

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