Home > Software design >  How many times a date has occured in a Date range
How many times a date has occured in a Date range

Time:11-05

I want to find how many times two days (1, 15) has occurred in a date range in Excel.

Let's say the date range is 1/4/2022 - 17/6/2022

so, the no. of times 1 and 15 has occurred 6 times.

I tried to look for inbuilt functions, couldn't find any so tried to do it via programming style (I am in programming field) but it has too many if and else and converting it to excel structure is getting troublesome.

I can share cpp program code if necessary if it helps in excel, which I don't think would be.

Is there any better way to do in excel?

CodePudding user response:

Use this formula as shown below in Excel

enter image description here


• Formula used in cell C1

=SUM(--(TEXT(SEQUENCE(B1-A1 1,,A1),"d") 0={1,15}))

In Google Sheets, the below formula works for me as well,

enter image description here

• Formula used in cell C1

=ARRAYFORMULA(SUM(--(TEXT(SEQUENCE(B1-A1 1,1,A1),"d") 0={1,15})))
  • Related