Excel weeknum conditional average - excel

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)

Related

Excel two column and condition

I have a column with dates like so where w represents weeks and d represents days.
Column1 Column2
in 1w3d out 1w5d
in 2w0d out 3w0d
in 24w2d out 23w0d
in 1w0d out 1w2d
Basically what I want to do is to check if both dates in Column 1 and Column 2 are between 1 week and 24 weeks. Both column values must be within the range.
Thus the output would be
Column1 Column2 Column3
in 1w3d out 1w5d Between 1 week and 24 weeks
in 2w0d out 3w0d Between 1 week and 24 weeks
in 24w2d out 23w0d Not between
in 1w0d out 1w2d Not between
I have an if statement for this written in excel that is like so
=IF(AND(A2>"in 1w0d,A2<"in 24w0d",B2>"out 1w0d,B2<"out 24w0d"),1,0)
However this does not get the desired results
Column3=MID(A2,SEARCH(" ",A2),SEARCH("w",A2)-SEARCH(" ",A2))*7+(MID(A2,LEN(A2)-1,1))
Column4=MID(B2,SEARCH(" ",B2);SEARCH("w",B2)-SEARCH(" ",B2))*7+(MID(B2,LEN(B2)-1,1))
Column5=IF(AND(C2>7,C2<24*7,D2>7,D2<24*7),1,0)
Maybe you need C2>=7 etc depending on where to draw the line

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.

Average based on day of the week

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.

Count specific column values by year in another date column in Excel

I have an excel table with two columns and several hundred rows. One column lists a single-digit code that represents an event, the other the date of that event. I'm attempting to count the number of times a particular event (say "1") occurred in a particular year (say 2017).
I normally use "COUNTIFS" for two or more criteria, but I'm stumped by the date format. I can't seem to get it to work in the formula. In this case, I'm using the yyyy-mm-dd format. How can I perform this operation?
A small example of the table is as follows:
------------------------
A B
--+--------------------+
1 Event Date
2 1 2016-09-12
3 1 2019-10-11
4 3 2017-03-24
5 2 2016-05-25
6 3 2017-08-02
7 1 2018-10-11
Just use
=COUNTIFS(A:A,1,B:B,">="&DATE(2017,1,1),B:B,"<="&DATE(2017,12,31))
EDIT:
if you have text-that-looks-like-dates, you can use SUMPRODUCT and YEAR:
=SUMPRODUCT((A2:A7=1)*(YEAR(B2:B7)=2017))

How to find values in one column in another column with multiple values

I have an excel like
A B START DATE END DATE
1 10 01-jan-2016 02-jan-2016
2 11 01- jan-2051 02-feb-2061
3 1 04-mar-2016 07-mar-2016
4 1 08-mar-2016 10-mar-2016
5 5 01-mar-2016 03-dec-2016
6 5 03-nov-2016 31-dec-4712
I am new to excel. I want to highlight or extract the columns in A column which can be found in B Column along with the start date and end date .
That is result should be like :
A start_date end_date
1 04-mar-2016 07-mar-2016
1 08-mar-2016 10-mar-2016
5 01-mar-2016 03-dec-2016
5 03-nov-2016 31-dec-4712
Can anyone pls suggest something ?
In E2 enter:
=IF(COUNTIF(A:A,B2)>0,"X","")
and copy down. Then filter the table
You can hide any un-wanted columns after that.

Resources