Calculate Column G - Column H if Column D is within date range

DH613

New Member
Joined
Dec 3, 2019
Messages
8
Office Version
  1. 2016
Platform
  1. Windows
Hi all,
I thought this would be easy, but I'm having difficulty figuring this out.
I have a basic transaction register on worksheet "2022" in my workbook. In column D I have the date of the transaction, and I put in the amount in column G if it's a debit, and in column H if it's a credit.
In Sheet 1 I have a list of months (1/1/2022 shown as January 2022, etc.) in column A and wanted to show the total value of credits minus debits for that month in column B.
I wrote - =IF(AND('2022'!D:D>=A2,'2022'!D:D<=A3),SUM('2022'!H:H)-SUM('2022'!G:G)) but that's not working.
What should I be doing?
 

Attachments

  • Screenshot 2022-11-07 161657.png
    Screenshot 2022-11-07 161657.png
    46 KB · Views: 9

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
How about
Excel Formula:
=SUMIFS('2022'!H:H,'2022'!D:D,">="&A2,'2022'!D:D,"<="&A3)-SUMIFS('2022'!G:G,'2022'!D:D,">="&A2,'2022'!D:D,"<="&A3)
 
Upvote 0
Solution
This should work

Book1
ABCDEFGHI
1Date ClearNameDescriptoionDebitCreditBalance
21/1/2022$ 1,671.001/3/2022xxx$ 88,337.76
32/1/2022$ 420.001/3/2022Donation$ 1,775.00$ 90,112.76
43/1/20221/3/2022Donation$ 1,304.00$ 91,416.76
54/1/20221/3/2022Donation$ 1,000.00$ 92,416.76
65/1/20222/25/2022Donation$ 820.00$ 93,236.76
71/3/2022Donation$ 360.00$ 93,596.76
81/3/2022Donation$ 200.00$ 93,796.76
91/3/2022Donation$ 75.00$ 93,871.76
101/3/2022Donation$ 7.00$ 93,878.76
111/3/2022Charity$ 650.00$ 93,228.76
121/3/2022Charity$ 650.00$ 92,578.76
131/3/2022Charity$ 500.00$ 92,078.76
141/3/2022Charity$ 500.00$ 91,578.76
151/3/2022Charity$ 400.00$ 91,178.76
162/25/2022Charity$ 400.00$ 90,778.76
171/3/2022Charity$ 350.00$ 90,428.76
18
19$ 3,450.00$ 5,541.00
20$ 2,091.00
Sheet1
Cell Formulas
RangeFormula
B2:B3B2=SUMPRODUCT($H$2:$H$17,--(MONTH($D$2:$D$17)=MONTH($A2)))-SUMPRODUCT($G$2:$G$17,--(MONTH($D$2:$D$17)=MONTH($A2)))
I3:I17I3=I2+H3-G3
G19:H19G19=SUM(G2:G17)
H20H20=H19-G19
 
Upvote 0
How about
Excel Formula:
=SUMIFS('2022'!H:H,'2022'!D:D,">="&A2,'2022'!D:D,"<="&A3)-SUMIFS('2022'!G:G,'2022'!D:D,">="&A2,'2022'!D:D,"<="&A3)
Worked perfectly, thank you
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,551
Messages
6,125,478
Members
449,233
Latest member
Deardevil

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