Formula Help

ashani

Active Member
Joined
Mar 14, 2020
Messages
354
Office Version
  1. 365
Platform
  1. Windows
Hi

I'm looking to count sickness occasion and number of days from the data table for each employee over the rolling 12 months. For example :

Greater than 01/01/2025 but less than 01/02/2024 during this range I want to count the following:

Column A : How many occasions employee was sick
Column B : How many days in total

Please can someone guide me with the formula. I tried using Sumproduct and Countifs but unable to get accurate detail.

Many thanks
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
how do you identify a SICK occurrence
how is your data laid out ?

A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

This will possibly enable a quicker and more accurate solution for you.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC

then put the sample spreadsheet onto a share

I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed

Make sure you set any share or google to share to everyone
 
Upvote 0
Thanks @etaf

The data comes like this and I would like to sumif for the number of days and countif for the occurrences during the date range mentioned above

1736097898281.png
 
Upvote 0
dont understand
Greater than 01/01/2025 but less than 01/02/2024

whats the date range


why does sumifs() and countifs() not work
are they REAL dates

you can use UNIQUE() and COUNTIFS() SUMIFS()

OR a Pivot table

Book1
ABCDEFG
1EMP NanedateDurationnamecountSum
2abc2/28/241abc11
3def1/2/253def13
4ghi1/1/255ghi15
5jkl5/28/244jkl211
6abc1/2/253
7def1/3/243
8ghi1/15/245
9jkl1/19/247
Sheet1
Cell Formulas
RangeFormula
E2:E5E2=UNIQUE(A2:A9)
F2:F5F2=COUNTIFS($A$2:$A$9,E2,$B$2:$B$9,">=1/1/24",$B$2:$B$9,"<1/1/25")
G2:G5G2=SUMIFS($C$2:$C$9,$A$2:$A$9,E2,$B$2:$B$9,">=1/1/24",$B$2:$B$9,"<1/1/25")
Dynamic array formulas.
 
Upvote 0
Thanks @etaf

So that's the date range for rolling 12 months and I want to data from >=01/01/2025 and <01/02/2024 hence the formula isn't working.
 
Upvote 0
that range will not work
>=01/02/24 and <=01/01/25

but it cannot be greater than 1st jan 25 and also less than 1 feb 24
 
Upvote 0
what would be the best option to get data for absences i.e. How many they have in January 2024 and how many they have in January 2025 combine?
 
Upvote 0
jan 25 has not finished
do you want to compare the current month with a year Ago month ?
OR just add the 2 months together
based on today() date / month

so on the 1st Feb do you then want to add together Feb-24 and feb-25 , even though the month has ONLY just started

sorry a little confused as to what dates you need

based on your example what are the results you expect
 
Upvote 0
Sorry for the confusion

i'm looking for How many occasion of absences an employee had in January 2024 and so far January 2025 and how many days in total as well.

so the data i'm looking for rolling 12 months month on month breakdown.
 
Upvote 0
for the table i posted
count
=ROWS(FILTER($A$2:$C$9,(MONTH($B$2:$B$9)=MONTH(TODAY()))*($A$2:$A$9=E2)))
SUM
=SUM(FILTER($C$2:$C$9,(MONTH($B$2:$B$9)=MONTH(TODAY()))*($A$2:$A$9=E2)))

are those the results you expected, if so i can explain what the formula is doing
if not why not

Book1
ABCDEFG
1EMP NanedateDurationnamecountSum
2abc2/28/241abc13
3def1/2/253def26
4ghi1/1/255ghi210
5jkl5/28/244jkl17
6abc1/2/253
7def1/3/243
8ghi1/15/245
9jkl1/19/247
Sheet1
Cell Formulas
RangeFormula
E2:E5E2=UNIQUE(A2:A9)
F2:F5F2=ROWS(FILTER($A$2:$C$9,(MONTH($B$2:$B$9)=MONTH(TODAY()))*($A$2:$A$9=E2)))
G2:G5G2=SUM(FILTER($C$2:$C$9,(MONTH($B$2:$B$9)=MONTH(TODAY()))*($A$2:$A$9=E2)))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,225,623
Messages
6,186,065
Members
453,336
Latest member
Excelnoob223

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