AVERAGEIFS Excel Formula Incorporated With Dates - excel

so I have an excel file with 2 tabs. 1 tab lists some values for Aug - Dec 2019 is separate columns while the other tab is the average of every 3 months (ie: Aug - Oct 2019, Sept - Nov 2019, Oct - Dec 2019).
I am trying to create a formula to give me the average of 3 months (listed in tab 1) if the KRI_ID column (in column A) is the same.
Note: Dates are input in custom format (mmm-yy)

You dont need an Averageif formula, since the KRI_ID is unique to each row. You can simply enter the following formula in cell J2 and drag across then drag down from J2 for the rest of the rows:
=Average(J2:L2)

Related

SUMIF using named array consisting of non-adjacent columns

Good morning!
I am trying to create a dynamic SUMIF by using a named array containing data in non-adjancent columns.
The situation is as follows:
I have a file with monthly data, where the columns are labelled as:
Jan 2010, Feb 2010, (...), Dec 2010, FY 2010 (...) Jan 2020, Feb 2020, (...), Dec 2020, FY 2020
I want to sum only the monthly data (Jan 2010, Feb 2010... Dec 2010, Jan 2011, Feb 2011, etc) and exclude the data in the FY column (FY 2010, FY 2011, etc etc)
I have named the array of monthly data that interests me as a range ("relevant_monthly_data")
I am looking at individual rows of data that interest me ("country_range"). Note that the country_range consists of only one column with all the countries. It has the same number of rows as "relevant_monthly_data".
The formula that I am using only works for the first set of adjacent columns (Jan-Dec 2010), but doesn't capture Jan-Dec 2011, 2012... all the way through to 2020 even though they are all part of the named array).
=SUM(INDEX(relevant_monthly_data,MATCH("Guatemala",country_range,0),))
Could you please help me?
I am sure it is a simple question, but I somehow cannot figure out how to sum this range beyond 2010 monthly entries...
Thank you in advance for your help!

countif adding up how many are in a certain month

I am trying to get a formula that counts up how many cells contain this month and how many cell contain < than current month eg: in a column
March 2015
January 2016
April 2016
May 2016
May 2016
May 2016
June 2016
And then have a cell at the bottom that tells me 3 for May and 3 out of date
Assuming your data were in column A and you had 15 points, then the following two formulae should work.
Number of cells in the current month:
=COUNTIF(A1:A15, "5/1/2016")
Number of cells before the current month:
=COUNTIF(A1:A15,"<5/1/2016")

Excel List - Dynamic

I have a list in Excel that allows me to drag-and-drop the following:
Y2014 Jan
Y2014 Feb
Y2014 Mar
Y2014 Apr
Y2014 May
Y2014 Jun
Y2014 Jul
Y2014 Aug
Y2014 Oct
Y2014 Nov
Y2014 Dec
I want the list to continue to Y2015 Jan and way beyond, but a list can only contain 255 characters. Is there a way to make this list continue? I want to be able to drag this list indefinitely, so that the year adjusts appropriately. Is this possible?
If you refer to a custom list, then you may want to consider a different approach.
Instead of a list, use real dates. In the first cell enter Jan-1-2014, next cell Feb-1-2014. Enter the dates according to your regional settings, so Excel recognizes them as dates, not as text. Then format with custom format
\Yyyyy mmm
Now drag down as far as you want. Excel recognizes that you want to increment by one month and the formatting shows the desired characters.
Alternative: You can have the real date in a helper column and drag down as described above. Leave the standard date format. In the column that is used by the macro, you can put a formula like this (if your date helper column is column Z, data starts in row 2):
=TEXT(z2,"\Yyyyy mmm")
The result of this formula is text. Drag down as far as required.

Adding Sum based on the month criteria

I am planning to add a simple formula to calculate the sum for each individual based on month (i.e. cell C14). If I change the month to March, then sum should be taken from Jan to Mar and if I change the month to December, then sum should be taken from Jan to Dec for that particular person.
I am currently using the follwoing formula, but it is coming too big. I have just added from Jan to Apr only and it is coming this long. I don't want such a big formula. Is it possible to change it to very simple formula?
=IF(C14="Jan",VLOOKUP(A17,$A$3:$M$11,2,0),IF(C14="Feb",VLOOKUP(A17,$A$3:$M$11,2,0)+VLOOKUP(A17,$A$3:$M$11,3,0),IF(C14="Mar",VLOOKUP(A17,$A$3:$M$11,2,0)+VLOOKUP(A17,$A$3:$M$11,3,0)+VLOOKUP(A17,$A$3:$M$11,4,0),IF(C14="Apr",VLOOKUP(A17,$A$3:$M$11,2,0)+VLOOKUP(A17,$A$3:$M$11,3,0)+VLOOKUP(A17,$A$3:$M$11,4,0)+VLOOKUP(A17,$A$3:$M$11,5,0)))))
Try this
B17: =SUM(OFFSET($A$2,MATCH(A17,$A$3:$A$11,0),1,1,MATCH($C$14,$B$2:$M$2,0)))
and fill down as needed.
I'm not sure if I can come up with a non-volatile formula.
In the above, we use the MATCH function to compute both the row offset into the table; as well as the width of the returned array.

Sort data into column bins in excel

Suppose one has data arranged vertically like this:
Name Birthday
John 6 June
Mary 12 May
Sue 1 June
Brian 10 August
Carl 24 June
Ted 18 August
Linda 31 January
Is it possible in Excel (without VB) to sort the data into column bins thus?:
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
Linda Mary John Brian
Sue Ted
Carl
(Even better would be to have them sorted within each bin by birth date.)
FYI, this is a bit complicated, so it might be hard to maintain/explain to someone else what you did.
Result:
In Cells D1 to O1, put in 1/1, 2/1, 3/1, etc
Select those cells, right-click --> Format Cells...
Choose Custom and put "mmm" (without quotes)
In D2, put this formula in there:
=IFERROR(INDEX($A$2:$A$8,SMALL(IF(MONTH($B$2:$B$8)=MONTH(D$1),MATCH("~"&$A$2:$A$8,$A$2:$A$8&"",0)),ROWS($2:2))),"")
Enter that formula with CTRL+SHIFT+ENTER (array formula)
At the bottom right of D2, there is a little black square, hover over this and your mouse will turn into a plus sign. Click this and drag down to cell D8.
Cells D2:D8 will be highlighted. Click the little square again found in D8. Drag to the right all the way till Dec
And there you have it.
I'd like to thank Aladin for the help with this formula:
http://www.mrexcel.com/forum/excel-questions/470371-unique-list-based-criteria.html#post2322387
Without modifying the data or using VBA, the closest I think you'll get is a PivotTable:
Click in your data
Insert --> PivotTable
OK
Drag the fields like this: Name--> Row Labels. Birthday --> Column Labels. Name --> Values
Right-click on a date in the column fields --> Group...
Select Months --> OK
Tada

Resources