Average based on day of the week - excel

I would like to have an overview of averages achieved in column H for each day of the week. The daily Averages should go into smaller table as per below. Thanks in advance.

You can do this, combining AverageIf() and Weekday() function, as in the following example I've created:
A B C
========== = =================
11/10/2021 6 =WEEKDAY(A1,2)=1
12/10/2021 8 =WEEKDAY(A2,2)=1
13/10/2021 5 =WEEKDAY(A3,2)=1
14/10/2021 8 =WEEKDAY(A4,2)=1
15/10/2021 6 =WEEKDAY(A5,2)=1
16/10/2021 4 =WEEKDAY(A6,2)=1
17/10/2021 2 =WEEKDAY(A7,2)=1
18/10/2021 2 =WEEKDAY(A8,2)=1
19/10/2021 6 =WEEKDAY(A9,2)=1
20/10/2021 8 =WEEKDAY(A10,2)=1
Afterwards, I've created the formula:
=AVERAGEIF(C1:C10,"TRUE",B1:B10)
This formula calculates the average of the values in column B for all Mondays in column A.
How does this work?
The Weekday() function calculates the number of the day of the week, based on a switch: when the switch is "2", it sees Monday as 1, Tuesday as 2, ...
The AverageIf() function then:
Checks the column C for the values to be checked
Checks those values against "TRUE"
Calculates the average of the B column for the values, obeying the aforementioned criteria.

Related

Excel formula help - I have 14/28 day readings averaged per day which need to be recorded as daily readings

Dates when the data was read are shown on the date column on the left, then worked out a value per day shown in ET/DAY column.
To analyze monthly data etc etc I want daily data so every day has the ET/DAY value between the dates it was read and inserted in the et/day column.
I have entered in manually what I want in blue but need a formula to do this as too long to do all manually
You can do this with MATCH. With an ascending list, if you give the magic number 1 as the third parameter, it will show the last row number with a smaller or equal number.
Here it's matched 17 with 15 in column A and the result is 2, for row 2:
A
B
C
1
10
=MATCH(17,A:A,1) = 2
2
15
3
20
So for your data, you can match the daily dates with the column on the left, and feed the row number into INDEX to look up from the ET/Day column.
A
B
C
D
E
1
Date
ET/Day
Daily
ET/Day
2
05/Jan/1995
05/Jan/1995
=Index(B:B, Match(#D:D,A:A,1)) = #N/A
3
19/Jan/1995
3.00
06/Jan/1995
=Index(B:B, Match(#D:D,A:A,1)) = 3.00
4
02/Feb/1995
5.41
07/Jan/1995
=Index(B:B, Match(#D:D,A:A,1)) = 3.00
5
...
...
6
19/Jan/1995
=Index(B:B, Match(#D:D,A:A,1)) = 3.00
7
20/Jan/1995
=Index(B:B, Match(#D:D,A:A,1)) = 5.41
There's an inconsistency here with the 05 Jan rate but it should be good after that.

In Excel how do I find a column then sum between two dates?

In excel I have a pivottable:
Project
11/1/2021
11/2/2021
11/3/2021
Dept 1
5
5
5
Dept 2
2
5
5
Dept 3
5
4
6
Dept 4
5
3
5
The table spans the full length of the month. I need a calculation that would find the department I input then sums all figures between today's date and the last day of the month:
Dept
Total
Dept 1
15
I have tried
=SUMPRODUCT(((Today()<=B1:K1)*(EOMONTH(TODAY(),0)>=B1:K1))*(A2:A5="Dept 1")*(B2:K5)
and various different vlookups but I can't figure out how to both find the correct row and then sum everything between the two dates in that row.
Assuming the following structure:
Try this, it works:
SUM(INDIRECT(ADDRESS(MATCH($B$2,$A:$A,0),COLUMN($B$6))&":"&ADDRESS(MATCH($B$2,$A:$A,0),MATCH($B$3,$6:$6,0)),TRUE))

Add business days in start date then subtract 1 business day (Excel)

My count of business days in end date should be, for example, May 30 to May 31 will be 2 days and May 30 to May 30 is already counted as 1 day. My problem with WORKDAY is that it counts the day from May 30 to May 31 as 1 day only.
What I've think of is to subtract the result of WORKDAY with 1 business day to get my desired result. However, with my current formula, I was only able to subtract the result of WORKDAY without concerning the weekends (=WORKDAY(C2,B2-1)).
So for example, column C is June 3 (Friday) and column B is 2. The output of my formula will be June 5 (Sunday) because of the subtraction, I want it to be June 6. How will I do that?
Column B = Duration
Column C = Start Date
Column D = End Date (Formula-based)
Column D:
=WORKDAY(C2,B2-1)
Provide Input
B | C | D
2 | 2016/06/03 |
Desired outcome
B | C | D
2 | 2016/06/03 | 2016/06/06
TRY
=WORKDAY.INTL(C2,B2-1,1)
This will set sat. and sun. as offdays
It is not clear exactly what you want to do.
If you want to do an inclusive count of Workdays from 2016/06/03 to 2016/06/06 then you could just use the NETWORKDAYS function.
If you want to add two workdays to Jun 3, and have Jun 3 count as the first day, to give you the result of Jun 6, then use
=WORKDAY(C2-1,B2)
That takes care of the issue where C2 is not a workday, and you want to count 1 workday as the first workday after C2
Otherwise, your formula should work as written.

Addition for two dimensional Excel

I needed some help with conditional addition in Excel.
This is an example data:
A B C D
1 Animal January February March
2 Cat 5 6 7
3 Cat 2 3 5
4 Dog 1 4 8
How can I write SUMIF on the conditions on, add total cats for the month of March?
I have been trying to experiment with SUMIF and written something like:
=SUMIF(A:A,Cat,D:D)
This is only going to work on one dimensional, meaning colum. How do I write a formula to calculate the sum of total cats in March? Column+ March , two dimensional.
You may try this:
=SUMIF(A1:A4;"Cat";INDEX(B1:D4; 0; 3))
The value of 3 in INDEX function means the third column (March), you may change it into 2 for February, and change it into 1 for January

Excel weeknum conditional average

Date Number Weeknum
4-Jan-96 0.094288 2
5-Jan-96 0.092872 2
8-Jan-96 0.090431 2
9-Jan-96 0.153586 2
10-Jan-96 0.029758 3
11-Jan-96 0.052083 3
12-Jan-96 0.042797 3
15-Jan-96 0.047949 3
16-Jan-96 0.053029 3
17-Jan-96 0.051588 4
18-Jan-96 0.036755 4
19-Jan-96 0.043954 4
22-Jan-96 0.067316 4
I want the average number where weeknum is a certain value -edit(and year is a certain value) without averaging for every week by hand. Does anyone know whether there is an averageif/if/other condition that can do this? Weeknum doesn't always contain 5 consecutive values because holidays are preventing that.
Try this:
=AVERAGEIF(C1:C13;2;B1:B13)
Column C is the week number column.
Argument #2 is the week number you're interested in.
Column B is the column with the values to average.
Column A: date
Column B: value for the date
Column C: Weeknum for the date
Column E: Weeknumbers (1..52)
Column F: =SUMIF(C1:C10;E1;B1:B10)/COUNTIF(C1:C10;E1)

Resources