Calculate Total Expense With Condition

kumara_faith

Well-known Member
Joined
Aug 19, 2006
Messages
955
Office Version
  1. 365
Hi,

I have the following table:


Book2
BCDEFGHIJKLMNOPQRSTU
3MonthExpense CategoryAmountToday5/12/2024MonthJanFebMarAprMayJuneJulyAugustSeptemberOctoberNovemberDecember
4JanLoans5000Average4560594311
5JanFood50Total Actual52255301529352175053
6JanAutomobile60Total Estimated6041
7JanMedical80
8JanFood20
9JanTemple15
10FebLoans5000
11FebFood150
12FebAutomobile65
13FebMedical45
14FebFood23
15FebTemple18
16MarLoans5000
17MarFood110
18MarAutomobile65
19MarMedical78
20MarFood15
21MarTemple25
22AprLoans5000
23AprFood125
24AprAutomobile25
25AprMedical17
26AprFood35
27AprTemple15
28MayLoans5000
29MayFood10
30MayAutomobile12
31MayMedical14
32MayFood12
33MayTemple5
Sheet1


The expense details is in the first table. In the second table, I am trying to calculate the average per month excluding the Loans expenses which is the outlier for every month. The total column includes the loans expense. I am trying to calculate the following:

1. The average expense for every month excluding the Loans in row J4:U4
2. In rowJ6:U6, I am trying to calculate the total expense for the current month based on the average expense for Jan-Apr . This will differ based on the current month. If the current date is June, then it will be Jan-May and so on.

The average expense per day for Jan-Apr excluding Loans is 52. The current date is 12 May 2024 with a balance of 19 days in May. Average expense of 52 X 19 days +5000(Loans) will result in 5988. Assuming total expense for May as of 12 May 2024 excluding Loans is 53, then total expense for May will be 6041

I tried the following but it did not work:

Excel Formula:
=IFERROR((AVERAGEIFS($D$4:$D$100000, $B$4:$B$100000, "<="&N3, $C$4:$C$100000, "<>"&"Loans") * (EOMONTH(G3,0)-G3+1)) + SUMIFS($D$4:$D$100000, $B$4:$B$100000, N3, $C$4:$C$100000, "Loans"), 0)

Please note that the actual range is from b4:b100000. This is a working file and the expenses will be entered everyday. The formula range will from B4:B100000 and the amount will be in the range d4:d10000. Both range will will have empty values as we enter the data every month from Jan to Dec 2024.



Is there a formula that could be used to accomplish this ? Appreciate all the help.
 
Last edited:

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,224,823
Messages
6,181,171
Members
453,021
Latest member
Justyna P

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