Count on how many tickets are logged this month - per series - excel

I have two columns - one with ID's in and one with the date it was created on.
Is there a way which will do a count on how many ID's were created in the current month - and will automatically reset itself when it falls into the next month.
E.g.
ID Creation Date
8.88 01/01/2019
8.89 01/01/2019
8.9 01/07/2019
1.1 01/07/2019
1.2 01/06/2019
1.3 01/05/2019
1.4 01/04/2019
5 01/07/2019
5.1 01/07/2019
5.2 01/06/2019
5.3 01/06/2019
If i use the current month (July 2019) - i would hope to see - ID which begin with 8, there was 1 created this month. ID'w which begin with 1 - 1 was created this month & ID's which begin with 5 - there were two created this month
Thank you

Assuming your data starts in A1 it would come down to:
"Is there a way which will do a count on how many ID's were created in the current month - and will automatically reset itself when it falls into the next month."
To get the total of entered ID's:
=SUMPRODUCT(--(MONTH(B2:B12)=MONTH(TODAY())))
You could also use a COUNTIFS formula like so:
=COUNTIFS(B2:B12,">="&EOMONTH(TODAY(),-1)+1,B2:B12,"<="&EOMONTH(TODAY(),0))
"Is there a way that it can be broken down into each ID. E,g, Taking the LEFT 1st number - e.g. Just reference against the 5 series numbers and returning the results."
To get the total of unique series numbers entered:
=SUM(--(FREQUENCY(IF(MONTH(B2:B12)=MONTH(TODAY()),MATCH(LEFT(A2:A12,1),LEFT(A2:A12,1),0)),ROW(A2:A12)-1)>0))
Entered as array formula through CtrlShiftEnter

If the dates are true dates then you can make a pivot table.
First we need to split the ID data on the "dot".
Insert a new column between ID and creation date.
Select the ID column and click Data -> text to columns.
Split the column on ..
The new column (B) needs to have a header. Just write whatever you want as header.
Go to insert -> pivot table
Then just drag creation date to Rows field (the months will be added automatically) then and ID to also to Rows field.
Then drag ID to the values field.
EDIT. I see now that my image shows the dates also. You can remove that from the rows field by just dragging it up again to the list.

Related

Calculating days between two oldest dates on varying amount of date values

I'm trying to calculate a number of days between two oldest days. The task would be easy, if it were only two dates, however - there could be 3 or 4 dates - I need to take the oldest and the earliest and just subtract them, however the challenge is varying amount of dates per ID.
I've got a pivot table where on the A column I have the ID and on the B column I have multiple rows of sorted dates for that ID. Example of Table (also adding a picture for reference):
Column A
Column B
ID 1
Date 1
Date 2
ID 2
Date 3
Date 4
Date 5
ID 3
Date 6
Date 7
Example: For ID 1 (in Column A) - to get the result that I need - I would do Date 2 - Date 1
Example: for ID 2 (in Column A) - to get the result that I need - I would have to do Date 5 - Date 3
Is there an easy way to do it in Excel? Or would I have to result to a programming language - putting IDs into Objects and storing all the dates into arrays and then manipulating it in arrays?
I've tried finding suitable functions in Excel and reading more about Pivot tables, but with no luck. Maybe someone can put in me on the right path.
If you are using Excel 365 you can use the following formulas.
If not, you have to replace the formula in D4 with a unique list of your IDs. And you will have to drag down the formulas for column E and F.
Using MINIFS/MAXIFS then retrieves the min/max dates of a single ID
"=(MAX(FILTER(B:B;A:A=A1)))-MIN(FILTER(B:B;A:A=A1))"
This solution works with Excel 365.
Filter function acts as a VLOOKUP function, but it can actually store multiple values and you can find Minimum and Maximum values for each ID and subtract them .

Excel - Create a pivot table by week that displays the weeks without dates with a null or 0 value

to keep it simple I have a spreadsheet that has dates that I need to create a pivot table with, grouped by week. The challenge is that I need to see the weeks that do not have dates. In the end I want to have a chart so there may be a way just through the chart.
Example Data:
1/3/2017 - 137
1/18/2017 - 10
1/19/2017 - 20
1/30/2017 - 45
1/31/2017 - 15
I would need something that showed the week. I will use the week number and sum the second column for the example above example.
Week - Data Total
1 - 137
2 - 0
3 - 30
4 - 0
5 - 60
I am not picky whether it is using MDX a formula, group, chart etc. The only thing that I do not want to do is add a date from all the missing weeks into the data.
If you create the Pivot Table using those two columns (dates as rows and numbers as values), then rightclick on the rows and select Group -> Days -> Number of Days 7, it'll divide all your dates into weeks and sum the values of each day. Want the weeknumbers? Add a column to the left of your Pivot Table and enter this formula:
=WEEKNUM(LEFT(B64;FIND(" ";B64 ) - 1 );2)
Substitute B64 for the cell of the Pivot Table containing the week range.
Here is what you can try:
The formula based on my setup:
=SUMPRODUCT(--(WEEKNUM($A$2:$A$6+0,2)=E2),$B$2:$B$6)
Try and let me know if this works or not.

EXCEL: MAX IF with multiple criteria to return name

I have the following task: Which country had has the highest level of traffic in week 11?
This is a snapshot of the table (with over 60.000 lines):
There is week 11 and 12 and multiple countries, so I need to find the country in week 11 which returns the highest sessions number/measure. I tried MAXIF and VLOOKUP, but I can't find a way to either return a name or incorporate multiple criteria (here: week 11 as restriction).
Any suggestions what to do?
Your data is begging to be used in a Pivot Table.
Highlight all of your data
Click Insert, then Pivot Table, then OK
Drag "Sessions" into your Values field and "Country" into your Rows field
By default the pivot table will give you a sum of sessions per country, you want to change this to a max
In the Values field, click on "Sum of traffic" then Value field settings
Summarize your data by max
And there you go!
Got it in 2 steps. Still trying to join them together into 1 formula.
Assuming that you enter your chosen week "2016-11" in H1
Enter the following formula in I1 to get the max number for that week
=MAX(IF(B2:B60000=$H$1,D2:D60000))
Enter this formula in J1 to get the country that matches the week and the max number.
=IFERROR(INDEX($A$2:$D$60000,SMALL(IF(($B$2:$B$60000=$H$1)*($D$2:$D$60000=$I$1),ROW($D$2:$D$60000)-1),ROW(1:1)),1),"")
IMPORTNANT use CTRL + SHIFT + ENTER when inputing these formulas.
UPDATE
SINGLE FORMULA assuming you have the week "2016-##" in H1
=IFERROR(INDEX($A$2:$D$60000,SMALL(IF(($B$2:$B$60000=$H$1)*($D$2:$D$60000=MAX(IF(B2:B60000=$H$1,D2:D60000))),ROW($D$2:$D$60000)-1),ROW(1:1)),1),"")

Is it possible to reference Cells via Cells in Microsoft Excel

In a spreadsheet i'm trying to fix up, on the final page i want it to gather totals, so far this is the structure
Month | Year | Month Start | Month End | Month Total
how this supposed to work is that the user enters the month and year then inputs the start and end rows (Month Start and End) of another page, this other page will contain records of transactions made with each transaction being a separate row, this can mean one month can have 5 transaction while another may have 50
i'm making the assumption that the user doesn't now how to reference data from another sheet so how i want to try and implement it so that they add the row numbers to Month Start and End and Month Total will generate the formula
eg.
Month Start = 4
Month End = 6
Formula Generated in Month Total = "=SUM(Transactions!E4:E6)"
if the user changes Month End to 9, the formula generated above will change the E6 part to E9, like i said above, each row in the Transactions sheet is a transaction and there can be variable number of transactions a month
what i am asking is if it is possible to references cells like this
Take a look at the INDIRECT function
You can use the OFFSET function to generate offsets from a starting point.
Assuming your layout is like this:
A B C D E
1 Year Month Start End Total
2 2012 Jan 4 9 =sum(...)
The total column (cell E2) could have the formula:
=SUM(OFFSET(Transactions!E1,C2-1,0,(D2-C2)+1))

Sum values in a column based on date

I have written this function that will give me a monthly sum for two columns: one has the date of each order, one has the cost of each order.
=SUMIF($C$1:$C$1000,">="&DATE(2010,6,1),$D$1:$D$1000)-SUMIF($C$1:$C$1000,">="&DATE(2010,7,1),$D$1:$D$1000)
Using data like this:
8/16/10 17:00 7.99
8/16/10 14:25 7.99
8/15/10 22:42 7.99
I end up with a table like this:
May 998
June 968.28
July 1239.76
August 514.96
However, now I would like to do daily sums and using my way I have to hand edit each row.
How can I do this better in Excel?
Use a column to let each date be shown as month number; another column for day number:
A B C D
----- ----- ----------- --------
1 8 6 8/6/2010 12.70
2 8 7 8/7/2010 10.50
3 8 7 8/7/2010 7.10
4 8 9 8/9/2010 10.50
5 8 10 8/10/2010 15.00
The formula for A1 is =Month(C1)
The formula for B1 is =Day(C1)
For Month sums, put the month number next to each month:
E F G
----- ----- -------------
1 7 July $1,000,010
2 8 Aug $1,200,300
The formula for G1 is =SumIf($A$1:$A$100, E1, $D$1:$D$100). This is a portable formula; just copy it down.
Total for the day will be be a bit more complicated, but you can probably see how to do it.
Use pivot tables, it will definitely save you time. If you are using excel 2007+ use tables (structured references) to keep your table dynamic. However if you insist on using functions, go with Smandoli's suggestion. Again, if you are on 2007+ use SUMIFS, it's faster compared to SUMIF.
Following up on Niketya's answer, there's a good explanation of Pivot Tables here:
http://peltiertech.com/WordPress/grouping-by-date-in-a-pivot-table/
For Excel 2007 you'd create the Pivot Table, make your Date column a Row Label, your Amount column a value. You'd then right click on one of the row labels (ie a date), right click and select Group. You'd then get the option to group by day, month, etc.
Personally that's the way I'd go.
If you prefer formulae, Smandoli's answer would get you most of the way there. To be able to use Sumif by day, you'd add a column with a formula like:
=DATE(YEAR(C1), MONTH(C1), DAY(C1))
where column C contains your datetimes.
You can then use this in your sumif.
Add a column to your existing data to get rid of the hour:minute:second time stamp on each row:
=DATE(YEAR(A1), MONTH(A1), DAY(A1))
Extend this down the length of your data. Even easier: quit collecting the hh:mm:ss data if you don't need it. Assuming your date/time was in column A, and your value was in column B, you'd put the above formula in column C, and auto-extend it for all your data.
Now, in another column (let's say E), create a series of dates corresponding to each day of the specific month you're interested in. Just type the first date, (for example, 10/7/2016 in E1), and auto-extend. Then, in the cell next to the first date, F1, enter:
=SUMIF(C:C, E1, B:B )
autoextend the formula to cover every date in the month, and you're done. Begin at 1/1/2016, and auto-extend for the whole year if you like.
If the second row has the same pattern as the first row, you just need edit first row manually, then you position your mouse pointer to the bottom-right corner, in the mean time, press ctrl key to drag the cell down. the pattern should be copied automatically.

Resources