Sort data into column bins in excel - 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

Related

Dynamic Range for Average Calculation

I am trying to come up with an Excel Formula to calculate 6 Months average value from Monthly prices.
A year is considered from April 2022 to March 2023 and so on. That means from April 2022 to Sept 2022 it is Half 1 and Oct 2022 to Mar 2023 it is Half 2.
Total time line is till March 2055. So, the formula has to be dynamic.
Please advise how I can use a formula for this averaging task.
The Data table look like below.
INPUT
Please refer the link to picture
OUTPUT
In Yellow in the picture below
Table Pic
Thank you!
It would be fairly simple if we had 'regular' half-year periods. Since half-years are shifted 3 months forward, we also need to shift the formula by three months. To achieve that, we have an OFFSET function that we can apply for the prices row. It will work fine for all the half-year periods with the exception of the first one since we'll have the prices range shifted. So, for the first half of 2022 in the cell B9 we will simply write =AVERAGE(B5:G5) and for all the rest, starting from C9, -
=AVERAGEIFS(OFFSET($B$5:$OG$5,0,3),$B$1:$OG$1,C7,$B$2:$OG$2, IF(C8=1,"<="&6,">"&6))
assuming that the months start in column B like in your example picture and finish in column OG as suggested from your task description.
If you want rolling 6mo periods, I prefer INDIRECT to OFFSET.
Assume the data runs vertically, each month is a separate row, and "X" is the cell of the latest value, this should work:
=AVERAGE(INDIRECT(ADDRESS(ROW(x), COLUMN(X))&":"&ADDRESS(ROW(X)-5, COLUMN(X))))

How to count unique days in excel after autofiltering

I have a sheet where I would like to count the unique days. What I mean by that is, the data covers 1 Jan 2017 to 31 Dec 2017, but not all dates are included. When autofiltered, even less days are showing. I have tried many different formulas I have been given, but they all fall over when the sheet is autofiltered for the required criteria. The closest one was an array formula, entered in Excel for Mac 16.43. It was entered using Ctrl & Shift & Enter
=SUM(IFERROR(IF(FREQUENCY(A3:A5524,A3:A5524),IF(SUBTOTAL(3,OFFSET(A3:A5524,ROW(A3:A5524)-ROW(A3),0,1)),1)),0))
It counts the correct number of days when the sheet is unfiltered, the number changes as the sheet is autofiltered, but again becomes incorrect when this is done. There might be a date range showing of 6 Jan 2017 to 20 June 2017, but only have 75 actual days showing in that range; nothing I have yet tried can get it accurate after autofiltering
The data is laid out in a pretty standard way with column A being date and it is formatted as Date and dd/mm/yyyy
Hopefully someone can suggest something which works
The answer ended up being the following
=SUM(IF(FREQUENCY(IF(SUBTOTAL(3,OFFSET(A3:A5524,ROW(A3:A5524)-ROW(A3),0,1)),A3:A5524),A3:A5524),1))
Rather than the original formula
cheers
Array formula
=COUNT(0/FREQUENCY(IF(SUBTOTAL(2,OFFSET(A2,ROW(1:5522),)),MATCH(A3:A5524,A3:A5524,),),ROW(1:5555)))
Note parameter, if column A is a date, the use of 2, if column A is text, using a 3, but FREQUENCY unavailable.

AVERAGEIFS Excel Formula Incorporated With Dates

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)

Excel: show matches occurrences

I have 1 column with dates and another with user log ins. I want to see how many times a user logged in per day.
02 January 2013 wright
02 January 2013 wright
02 January 2013 paula
02 January 2013 john
02 January 2013 paula
03 January 2013 john
03 January 2013 wright
I want to turn this into
02 January 2013 03 January 2013
wright 2 1
paula 2 0
john 1 1
Is there an easy way of doing this? Thank you for any help.
I understand that I can use pivot table to change the spreadsheet into this:
02 January 2013 03 January 2013
wright
paula
john
But do not understand how I can use pivot table to add the instances of each logged entry to a date.
You can use VBA which gives you full control on the output.
Are you familiar with VBA? If so I can provide you the code.
lets assume your list of dates in in column B and your list of user ids in in column C.
Generate a list of unique names
in this case I am arbitrarily generating the table in E9 as the top left corner. In E10 I place the following CSE formula (mean you press CONTROL+SHIFT+ENTER instead of just ENTER). You will know you have done it right when excel adds {} around the formula. You cannot manually added them.
=IF(ISNA(INDEX($C$2:$C$20, MATCH(0, COUNTIF($E$9:E9, $C$2:$C$20), 0))), "", INDEX($C$2:$C$20, MATCH(0, COUNTIF($E$9:E9, $C$2:$C$20), 0)))
Copy down as far as you need
Place a date in excel format in F9
Copy right as far as you need. It should increase by one day for each column copied
In cell F10 place the following formula and copy and paste down and to the right as far as required.
=COUNTIFS($C:$C,$E10,$B:$B,F$9)
Having said all this a pivot table can do it much quicker and faster.

Weekday/ work day excel dates

How do you do this in excel without entering it all manually for the rest of the year? Its work days.
JANUARY
03 04 05 06 09 10 11 12 13
T W T F M T W T F
So for January I need all the work days in numbers and in days in text like below:
For January the first working day is 03 and that day is T(Tuesday). I need a formula to show on the first column 03 and then the 2nd row will show T for tuesday. I want this to continue for the rest of January.
January
03
T
If you don't mind using Analysis ToolPak functions you can try this approach:
First you need a list of holiday dates, e.g. 2nd Jan 2012, 6th April 2012. List these one per cell, perhaps in another worksheet and name that list holidays.
In A1 put the first of the month you want to see, e.g. 1/1/2012 (if you want it to default to current month always then use this formula =EOMONTH(TODAY(),-1)+1) - format that cell as mmm-yy
Now use this formula in A3 copied across to W3
=IF(WORKDAY($A1-1,COLUMNS($A3:A3),holidays)>EOMONTH($A1,0),"",WORKDAY($A1-1,COLUMNS($A3:A3),holidays))
format cells with custom format dd
and then in A4 use this formula copied across to W4
=LEFT(TEXT(A3,"ddd"))

Resources