I have a spreadsheet with a table containing multiple weeks, it has columns and rows like so:
Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat Sun Mon
User 1
User 2
User 3
User 4
A letter "H" will be enters for a users/day when they have booked some holiday, I need to count for each user the number of each days that they have taken as holiday.
I wrote the formula: =COUNTIF(INDEX($N:$NMMATCH("Sun",$N:$NM)),"H")
But this obviously it only returns a count for the first "Sun" column it finds and ignores all the Sundays after.
Does anyone know how this can be accomplished?
If the range for user 1 is N2:NM2 and the headers are in N1:NM1 try this formula to count Suns with "H"
=COUNTIFS(N$1:NM$1,"Sun",N2:NM2,"H")
You can copy that down for all users
Use COUNTIFS:
=COUNTIFS(2:2;"H";$1:$1;"Sun")
Now if you make a small table with Mon up to Sun as headers above it and refer to that for the 4th parameter you can ditch the "Sun"
Related
I'm trying to write an Excel function to grab the value of the Running Total in rows that are on the first of the month in the Date column. Where there are more rows with the same date, I want to grab the last value. (The dates are in ascending order.)
This is an example of the kind of table I'm using:
Income
Running Total
Date
$1,000.00
$1,000.00
Jun 30, 22
-$60.00
$940.00
Jul 01, 22
-$42.00
$898.00
Jul 20, 22
-$55.00
$843.00
Aug 01, 22
-$200.00
$643.00
Aug 01, 22
-$60.00
$583.00
Aug 19, 22
-$20.00
$563.00
Sep 01, 22
$334.00
$897.00
Sep 10, 22
-$610.00
$287.00
Oct 01, 22
-$50.00
$237.00
Oct 02, 22
I have a formula for calculating the running total and the date is created with the DATE() function.
I'm planing to use the function in a new table on the same sheet. In each row is the running total of the first of that month.
Month
Amount
Jul
Aug
Sep
Oct
The problem is that I'm expecting this table to grow and I don't want to manually search each row. I would like to have a function that goes through the Date column and identifies if it contains the date of the first day of the month, if it does, get the running total.
I have attempted something like this:
=CONCAT("$B",MATCH(”Jul 01, 22”,$C1:$C100,1))
But I don't know how to create the function or whether or not this works.
How can I write a function that grabs the Running Total on the first of the month?
You can use either INDEX() & MATCH() or XLOOKUP()
• Formula used in cell F2
=INDEX($B$2:$B$11,MATCH(DATE(2022,MONTH(E2&1),1),$C$2:$C$11,1))
Or,
• Formula used in cell H2
=XLOOKUP(DATE(2022,MONTH(E2:E5&1),1),C2:C11,B2:B11,,1,-1)
or, can exclude the 5th parameter, of XLOOKUP() as well
• Formula used in cell H2
=XLOOKUP(DATE(2022,MONTH(E2:E5&1),1),C2:C11,B2:B11,,,-1)
I am not very good at Excel. In the NHS (UK) we often schedule activity by looking at the columns on a calendar (e.g. All day theatre list Mondays week 1,3,5). This means on the first Monday, third Monday and if present fifth Monday. Using a printed calendar you can see the columns, for example Mondays in Jan 2023 where there are five.
When planning, it would be great to have a formula that would accept a date, and return the ordinal of the weekday for that month e.g.
Jan 02 2023 = 1
Jan 28 2023 = 4
Jan 29 2023 = 5
Jan 30 2023 = 5
I have searched and found the WEEKNUM function, but this counts rows on the calendar not giving the result I need.
Any help gratefully received
Kind Regards Gavin Holt
This should return those values:
=-INT(-(DAY(YourCellWithTheDate))/7)
I have two excel sheets, I am trying to find all user details along with request IDs that are accessed on a particular date and time range.
Sheet 1: Request
A
B
C
D
E
User
Request ID
Startdate
enddate
Business reason
100
1234567
Jul 01, 2022 03:24:11
Jul 01, 2022 06:10:11
SRQ123456
101
1234568
Jul 01, 2022 06:24:11
Jul 01, 2022 08:24:11
CHG123456
Sheet 2: Access details
A
B
C
D
OBJECTNAME
ACTION
ACCESSBY
ACCESSTIME
Business User
Update
100
Jul 01, 2022 05:59:12
Workflow
Update
100
Jul 01, 2022 06:05:20
Roles Add Workflow
Update
100
Jul 01, 2022 06:10:32
SFA
Delete
101
Jul 01, 2022 06:24:12
Tried the below code result to find out the record within the date range but I am not able to get the entire row details of sheet1:Request. I have used Name manager from the formula to store the value of Startdate, enddate, and User.
=IF(COUNTIFS(Startdate,"<="&D3,enddate,">="&D3,User,C3)>0,"Yes","No")
Sheet 2: Access details
A
B
C
D
E
OBJECTNAME
ACTION
ACCESSBY
ACCESSTIME
Business User
Update
100
Jul 01, 2022 05:59:12
Yes
Workflow
Update
100
Jul 01, 2022 06:05:20
Yes
Roles Add Workflow
Update
100
Jul 01, 2022 06:10:32
No
SFA
Delete
101
Jul 01, 2022 06:24:12
Yes
The expected output in Sheet2 should be as below
A
B
C
D
E
F
G
H
I
J
OBJECTNAME
ACTION
ACCESSBY
ACCESSTIME
User
Request ID
Startdate
enddate
Business reason
Business User
Update
100
Jul 01, 2022 05:59:12
Yes
100
1234567
Jul 01, 2022 03:24:11
Jul 01, 2022 06:10:11
SRQ123456
Workflow
Update
100
Jul 01, 2022 06:05:20
Yes
100
1234567
Jul 01, 2022 03:24:11
Jul 01, 2022 06:10:11
SRQ123456
Roles Add Workflow
Update
100
Jul 01, 2022 06:10:32
No
Record not matched
SFA
Delete
101
Jul 01, 2022 06:24:12
Yes
100
1234568
Jul 01, 2022 06:24:11
Jul 01, 2022 08:24:11
CHG123456
There are multiple ways to do this.
I will assume that the date values in both, Sheet 1 and Sheet 2, are formatted as dates and not as text. If that is not the case, additional formulas for conversion to date format will be needed.
You could try the following solution:
=OFFSET(Sheet1!$A$1:$E$1,MATCH(1,($C3=Sheet1!$A:$A)*($D3>=Sheet1!$C:$C)*($D3<=Sheet1!$D:$D),0)-1,0)
However, there is no error handling embedded here yet which leads to an error for the 3rd row of data on sheet 2 with the example data that you provided. The date and time of the "access" in the 3rd row is not within the given start and end dates of that "user" on sheet 1 (screenshot for clarification)
Therefore, for those 4 rows of data the formula will return the following result:
If you want the formula to return something else than the #N/A error, use the =IFERROR(value,value_if_error) function, where 'value' would be the formula above.
I'm working on a spreadsheet that two conditions have to true in order to be counted. If the month is January, and the number next to it is less than or equal to 30, then it's counted. Same rule applies for all the other months.
Thus far, I have:
=COUNTIFS(Sheet1!D2:D7,(SUMPRODUCT(--(MONTH(D2:D7)=1))),Sheet1!E2:E7,(COUNTIFS(E2:E7,"<=30")))
For example:
Column D
Jan 1, 2014
Feb 3, 2014
Feb 16, 2014
Mar 5, 2014
Mar 13, 2014
Mar 29, 2014
Column E
37
25
30
31
1
16
Outcome
Jan 0
Feb 2
Mar 2
It's fairly easy. Try this:
{=SUM(IF(MONTH($D$2:$D$7)=1,1,0)*IF($E$2:$E$7<=30,1,0))}
Of course you can replace the =1 part with a reference to a cell with the month number or even =MONTH(H2), for example, given a cell with a date in it so you can build your formula as a table.
Note: the only trick to this is that the formula must be entered as an array formula. So do CNTL+SHIFT+ENTER when entering in the formula.
I have a google spreadsheet having data as below
Date SomeVal
Aug 01, 2013 1
Aug 02, 2013 5
And so on. I want to have another sheet with Monthly grouping as follows(This is what I want in the end but unable to get here)
Month Total
Apr 2013 200
May 2013 300
I tried following but could not get correct result
=SUMIFS(Sheet1!B:B,Sheet1!A:A,ʺ> Aug 1, 2013ʺ) //Returns SUM(B:B) as all dates are above Aug 1 2013
=SUMIFS(Sheet1!B:B,Sheet1!A:A,ʺ< Jun 1, 2014ʺ) //Returns 0 which is wrong
This is what I expected to get
sum for which date > Aug 2013
sum for which date < Jun 2014
My date format is Mon DD, YYYY
Any idea Where I am wrong
This format works for me
Raw Data in Sheet2
(Column A) (Column B)
Date Val
----------- ---------
7/1/2013 1
7/2/2013 2
7/3/2013 3
7/4/2013 4
And so on and so forth up until 2/9/2016 (as long as they are date values you can format them however you want)
Summed Data in Sheet1
(Column A) (Column B)
Month Total
---------- ---------
Jul 2013 496
Aug 2013 1457
Sep 2013 2325
Oct 2013 3348
Nov 2013 4155
So on and so forth for each month that I want, using this formula. Each month is formatted as MMM YYYY, and the date is the first of the month (7/1/2013, 8/1/2013, etc...)
=SUMIFS(Sheet2!$B:$B,Sheet2!$A:$A,">="&Sheet1!$A2,Sheet2!$A:$A,"<"&Sheet1!$A3)
This says
Sum the range in Sheet 2 Column B where:
The date in column A of that row is greater than the first of the month supplied
The date in column A of that row is less than the first of the month afterwards