how to compute days between dates excel with per month

ahmedshehta

New Member
Joined
Feb 10, 2025
Messages
5
Office Version
  1. 2016
Please help me to find an exact formula to extract how many days per month


Start DateEnd Date Total DaysJan-25Feb-25Mar-25
2024/11/222025/01/0545
2025/01/282025/01/281
2025/01/052025/01/095
2025/01/232025/01/231
2025/01/132025/01/131
2025/01/082025/01/092
2025/01/162025/01/161
2024/12/152025/01/1532
2025/01/112025/02/1031
2024/12/112025/01/1031
2025/01/012025/01/2222
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Hi, this assumes that the months along the top are dates and are the first of each month, formatted as mmm-yy

Book1
ABCDEF
1Start DateEnd DateTotal DaysJan-25Feb-25Mar-25
222/11/202405/01/202545500
328/01/202528/01/20251100
405/01/202509/01/20255500
523/01/202523/01/20251100
613/01/202513/01/20251100
708/01/202509/01/20252200
816/01/202516/01/20251100
915/12/202415/01/2025321500
1011/01/202510/02/20253121100
1111/12/202410/01/2025311000
1201/01/202522/01/2025222200
Sheet1
Cell Formulas
RangeFormula
C2:C12C2=B2-A2+1
D2:F12D2=MAX(0,MIN($B2,EOMONTH(D$1,0))-MAX($A2,D$1)+1)
 
Upvote 0
Thank you so much Sir I really appreciate it

Please another help employees number 5437 has two rows how to count this in( Total , Jan 25 , Feb 25 )

serialEmployess NumbernamesortperiodTotalJan-25Feb-25
From To
15437saberأجازة مرضيه مرض مزمن11/01/202510/02/2025312110
25437saberأجازة مرضيه مرض مزمن11/12/202410/01/202531100
15205729ahmedمرضي29/01/202530/01/2025220
16206136ahmedمرضي02/02/202502/02/2025101
17206136ahmed مرضي16/01/202516/01/2025110
 
Upvote 0
Hi, I'm not really following. Is that table you've shown your expected results? Is it columns Jan-25 and Feb-25 you're trying to calculate? If it is, I think you'll need to add a description of how you arrive at those totals.
 
Upvote 0
Hi, something like this.

New Microsoft Excel Worksheet (2).xlsx
ABCDEFGH
1SerialEmployee NumberNameفترة الاجـــــازة Total DaysJan-25Feb-25
2FromTo
315437Ahmed Mohamed11/01/202510/02/2025312110
425437Ahmed Mohamed11/12/202410/01/202531100
5Total623110
63205548Adel Mousa01/01/202522/01/202522220
74205548Adel Mousa23/01/202531/01/2025990
8Total31310
955446Mohamed Aly02/01/202501/02/202531301
1031301
ورقة1
Cell Formulas
RangeFormula
F3:F4,F6:F7,F9F3=E3-D3+1
G3:H4,G6:H7,G9:H9G3=MAX(0,MIN($E3,EOMONTH(G$1,0))-MAX($D3,G$1)+1)
F5:H5,F8:H8F5=SUM(F3:F4)
F10:H10F10=SUM(F9)
 
Upvote 0
Hi, something like this.

New Microsoft Excel Worksheet (2).xlsx
ABCDEFGH
1SerialEmployee NumberNameفترة الاجـــــازة Total DaysJan-25Feb-25
2FromTo
315437Ahmed Mohamed11/01/202510/02/2025312110
425437Ahmed Mohamed11/12/202410/01/202531100
5Total623110
63205548Adel Mousa01/01/202522/01/202522220
74205548Adel Mousa23/01/202531/01/2025990
8Total31310
955446Mohamed Aly02/01/202501/02/202531301
1031301
ورقة1
Cell Formulas
RangeFormula
F3:F4,F6:F7,F9F3=E3-D3+1
G3:H4,G6:H7,G9:H9G3=MAX(0,MIN($E3,EOMONTH(G$1,0))-MAX($D3,G$1)+1)
F5:H5,F8:H8F5=SUM(F3:F4)
F10:H10F10=SUM(F9)
Thank you for you kind reply
I don't want a formula here I want to make a quick subtotal
As you see you , Similar employees number may be repeated two times or three times or may be an unique
With that reference I want make subtotal for days in January and Feb
 
Upvote 0
Hi, so you're looking for code to insert the sub totals? That seems to be a very different question to the OP and probably deserves its own thread.
 
Upvote 0
Yes I want to insert subtotal with reference Employee Code
Shall I ask for that in another thread ?
Hi, so you're looking for code to insert the sub totals? That seems to be a very different question to the OP and probably deserves its own thread.
 
Upvote 0

Forum statistics

Threads
1,226,525
Messages
6,191,566
Members
453,665
Latest member
WaterWorks

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