Excel: show matches occurrences - excel

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.

Related

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)

Convert date column

I have data in an excel sheet. There I have a column with date values like this.
13 May 2012
27 August 2012
21 June 2012
18 March 2012
16 November 2011
15 December 2011
Is there a way to convert it to a format like this? 1998-12-25
I am assuming your dates are stored as strings. If one of your data is in cell A1, use in B1
=DATEVALUE(LEFT(A1,FIND(" ",A1)-1)&" "&LEFT(MID(A1,FIND(" ",A1)+1,FIND(" ",RIGHT(A1,LEN(A1)-FIND(" ",A1)))-1),3)&" "&RIGHT(A1,4))
Then format B1 as Custom, Type: yyyy-mm-dd.
Shorter formulas are possible, in particular if you can assume that the day will always have two digits (e.g., 01, and never 1).
If your data are stored as numeric instead of string, then simply apply the formatting procedure described.

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

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