Sumifs with Date Criteria

ChetanPuri

Board Regular
Joined
Sep 5, 2018
Messages
74
Office Version
  1. 365
Platform
  1. Windows
Hello Excel Gurus,

I have a question , I have three companies 2 based on Quarterly reporting and one based on monthly reporting, I am trying to create a Sumifs formula based on criteria, you will see in Rows D1, H1 and L1, I got Quarterly or Monthly in it and then right I got Q2, R 2 and S 2 , I want a formula to calculate the sum from sheet 2 based on the dates but if it says quartely then it sums all the data between the quartely dates and if it says monthly then does it for month only. Any help wopuld be appreciated.


Book1
ABCDEFGHIJKLMNOPQRST
1CODESCosting Work ID60Quaterly21Quaterly50MonthlyYearStart DateMonthlyQuarterly
2GST CodesTransaction TypeEx GSTGST AmountGST InclusiveEx GSTGST AmountGST InclusiveEx GSTGST AmountGST Inclusive202401-Jul-2431-Jul-2430-Sep-24
3A0AP INV2,673.630.002,673.637,261.090.007,261.09474,182.040.00474,182.04
4A1AP INV309,929.0330,992.89340,921.922,523,349.49252,335.042,775,684.532,668,871.17266,887.452,935,758.62
5A1AP CRD(2,931.82)(293.18)(3,225.00)(1,389.41)(138.92)(1,528.33)(28,644.41)(2,864.48)(31,508.89)
6A1DR DBT0.000.000.00(6,519.65)6,519.65(0.00)
7A2AP PPI872.000.00872.000.000.000.000.000.000.00
8A2AP INV246.300.00246.3017,602.750.0017,602.75175,927.890.00175,927.89
9A2AP CRD0.000.000.00(719.00)0.00(719.00)(5,318.72)0.00(5,318.72)
10A4AP INV102.000.00102.00159.500.00159.500.000.000.00
11A5AP INV0.000.000.0074,000.007,400.0081,400.000.000.000.00
12Total as per GL310,891.1430,699.71341,590.852,620,264.42259,596.122,879,860.543,278,498.32270,542.623,549,040.94
Sheet1
Cell Formulas
RangeFormula
R2R2=IF(R1="Quarterly",EOMONTH(Q2,ROUNDUP(MONTH(Q2)/3,0)*3-MONTH(Q2)),IF(R1="Monthly",EOMONTH(Q2,0),"Invalid input"))
S2S2=IF(S1="Quarterly",EOMONTH(Q2,ROUNDUP(MONTH(Q2)/3,0)*3-MONTH(Q2)),IF(S1="Monthly",EOMONTH(Q2,0),"Invalid input"))


Book1
HIJKLMNOP
1Journal DateTransaction TypeCred/Debt No.Tax CodeInternal ReferenceCreditor/Debtor NameGL DescriptionCosting Work IdTransaction Amount
215-08-2024AP INVBUNNINA1200126777560111.02
304-09-2024AP INVSTABLIA1000244606096.82
401-07-2024AP INVHALSERA194000657260175,645.17
516-06-2024AP INVWEBSTERA1154942601,510.00
616-07-2024AP INVKPMGA0821633110601,720.40
Sheet2
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
You have not said where this formula is to go or just what conditions apply to the SUMIFS but see it this helps get you where you want to go.
I have added formulas in E1, I1 and M1 to add the figures from column P of Sheet2 where the Costing Work ID in C1, G1 and K1 match those in Sheet2 column O and the dates in Sheet2 column H are in the relevant range.

I have added some more sample data to Sheet2

ChetanPuri.xlsm
HOP
1Journal DateCosting Work IdTransaction Amount
215-08-202460111.02
304-09-20246096.82
401-07-202460175,645.17
516-06-2024601,510.00
616-07-2024601,720.40
715-08-2024211,929.00
804-09-2024501,752.00
901-07-2024214,313.00
1016-06-2024503,847.00
1116-07-202450923.00
1215-08-2024602,175.00
1304-09-2024212,334.00
1401-07-202450604.00
1516-06-2024212,315.00
1616-07-202450469.00
1715-08-2024604,151.00
1804-09-2024211,509.00
1901-07-2024501,278.00
2016-06-2024602,890.00
Sheet2


ChetanPuri.xlsm
ABCDEFGHIJKLMNOPQRS
1CODESCosting Work ID60Quarterly183899.4121Quarterly1008550Monthly3274YearStart DateMonthlyQuarterly
2GST CodesTransaction TypeEx GSTGST AmountGST InclusiveEx GSTGST AmountGST InclusiveEx GSTGST AmountGST Inclusive202401-Jul-2431-Jul-2430-Sep-24
Sheet1
Cell Formulas
RangeFormula
E1,M1,I1E1=SUMIFS(Sheet2!$P2:$P100,Sheet2!$O2:$O100,C1,Sheet2!$H2:$H100,">="&$Q2,Sheet2!$H2:$H100,"<="&IF(D1="Quarterly",$S2,$R2))
R2R2=IF(R1="Quarterly",EOMONTH(Q2,ROUNDUP(MONTH(Q2)/3,0)*3-MONTH(Q2)),IF(R1="Monthly",EOMONTH(Q2,0),"Invalid input"))
S2S2=IF(S1="Quarterly",EOMONTH(Q2,ROUNDUP(MONTH(Q2)/3,0)*3-MONTH(Q2)),IF(S1="Monthly",EOMONTH(Q2,0),"Invalid input"))
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,190
Members
452,616
Latest member
intern444

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