Convert date in Excel to its respective week of the month - excel

Hopeful you can help me out.
I have an Excel spreadsheet open. The spreadsheet has two columns that I need assistance with.
The first column are dates and times that reflect a ticket that opened. The second column reflects dates and times that a ticket closed.
I am needing to correlate all the dates of which every ticket opened and closed to its respective week of the month. So if I have 20 tickets that opened up between the days of 2/22/15 - 2/28/15(all these dates are in the same column fyi...), then I will be needing to somehow correlate these tickets in my spreadsheet to some form of data to be used in a line stack chart.
An exec has laid this on my lap. I don't look useless and I would like a little assistance as to how to perform such a task. Formulas in Excel...Vlookup....or using Pivot Tables....please assist!

convert date in excel to its respective week of the month
in conjunction with the date range example:
=INT((DAY(A1)-1)/7)+1

In column 3 use the =Weeknum(A1, 1) formula to get the week number of the date in column a. The second argument lets you determine what you want for the beginning of the week to be.
In column 4 do the same for column b. This will give you the week ticket opened/closed respectively. Add column 5 to be the difference in weeks which can be used in a pivot table to show the distribution of tickets and weeks to resolve, etc.
Reply back if you have further needs.

Firstly get the week num of the first day of the month -1
A1 = 01/02/2018
B1 = =WEEKNUM(A1)-1
Then calculate the individiual ticket week numbers and take the week number before the first week of the month away from the returned value. You may need to format the cells as numbers as some reason Excel thinks its a date
Open Week = =WEEKNUM(OpenDateCell)-$B$1
Close Week = =WEEKNUM(CloseDateCell)-$B$1
Representative Image:

Related

How do I sum a total number of occurrences of a ID number with a specific month and year in Excel

I have a Excel Master sheet where I am looking to query other sheets within the workbook. What I am trying to do is see How many occurrences of an ID for a Project in a column occur within a month, e.g. how many times does the ID 1367 occur in November. My dates are in the format of e.g 13/11/18 and this cannot be changed as I am just creating a report against a workbook I do not own.
The relevant columns I need are formatted like so:
Project: Project ID: Date:
a 123 1/01/2018
a 123 2/01/2019
a 123 3/01/2018
a 123
This is my SUMIFS function:
=SUMIF(PPlanner!$D:$D,Dashboard!$B$6,PPlanner!X:X)
This works by itself. My problem is trying to get the ID total for a specific month.
It returns the number of occurrences the ID occurs against a project all together but not against the month specifically. I have tried adding syntax to specify
the month but I am getting errors such as "too many arguments".
I recently answered a question that was very similar :
Excel - Take Average of Monthly Data
I think this would answer your question as well, but you have to use COUNTIFS instead of AVERAGEIFS
As for presentation, I would make a separate list of the months you want to include, and put the formula next to it, instead of the formula next to the actual list of data (as in the other question). As for how to write/input the month, you can put it any way you want, as long as it is a valid date in Excel. With the cell formatting you then can show it as month and year only. This is just to say that a text input JANUARY 2018 does not work (in a normal cell, eg. a cell that you did not format as text, when you type that into the cell, Excel recognizes this as a date, and will actually put 1/1/2018).
Oh, and using a Pivot table would work as well, the other answer on the question referenced above also explains how to do that.
In some cases, how Excel handles dates is very convenient.
For you, the date format doesn't matter. It is simply a number counting days with 0 being December 31st, 1899.
13/11/18 the date is the integer 43417 in-cell value. Excel interprets this as a both date and time together. The whole numbers are the days while the decimals are the time of day as a fraction of the day. 43417.5 would be noon.
So you may use COUNTIFS to help here.
=COUNTIFS(PPlanner!$X:$X, 1367, PPlanner!$D:$D, ">"&43404, PPlanner!$D:$D, "<"&43435)
This is going to look at sheet PPlanner column X and count how many instances of 1367 occur after the last day of October and before the first day of December. There are other ways to accomplish this, but it allows you to count within any date range you want.

filter data between 2 dates in excel using VBA

i was wondering if someone can help. i have tried some formulas but cant seem to work this out. i have a list of data with lots of dates some duplicate dates which are fine. i have data on a daily basis from 2015-2018. my aim is to try to put a number against each week between 2 dates so Monday-Sunday representing a week. so if the date falls between to dates bring back the week number. but of course there is a long list of date ranges and week ranges. does anyone know a formula or code to read to date and look between 2 separate dates and bring back a week number
thanks
Muj
For a given date, weeknum() will return the week number:

Best Way to Subtract User Inputted Date in Cell From a Set Date (Day/Month) Irregardless of the Year

I am trying to establish the best way to write a formula to take a date that is inputted in a cell by a user and subtract it from the last day of the month (the due date), not taking into account what year it is. The cell that contains the formula will be in another cell, pointing at the user inputted date cell.
I have 12 columns running across with each with one of the months of the calendar year. In each column for the corresponding month is where the user will input the date they completed a task. I would like to subtract their input from the last day of the corresponding month in that column. I want to reuse this spreadsheet every year, so I do not want to account for the year in my formula. I hope this will prevent me having to update the formulas each year.
An example would be if the user inputted 2/24/17 into C7, because the column C is the column for February, I would like the result to be -3 (I am not worried about leap years at this point). If they inputted 3/11/17 into the same cell (C7), they would get a result of 11, because the date is 11 days past the due date.
Here is the formula that I started to use, but I believe it is relative to the current year.
=IF(ISBLANK(C7),"",C7-(DATE(YEAR(TODAY()),MONTH(1)+2,1)-1))
Here is a link to a picture of my spreadsheet. Thank you in advance for your help!
Solution
Changed YEAR(TODAY()) to YEAR(target cell). My new formula looks like:
=IF(ISBLANK(C7),"",C7-(DATE(YEAR(C7),MONTH(1)+2,1)-1))
Maybe:
=IF(C7="","",C7-EOMONTH(C7,-1))
(based on #barry houdini's Comment and subsequent OP clarification via a Comment).

Generate trend graph in excel

I encountered a practical problem that can be simplified as follows:
My excel sheet has a single column which is the date I had a beer can. It can repeat based on the number of beers cans I had a day. (eg. I had three beers on 5/9/2012) I need to generate the trend of my beer consumption per week. How can I do it in excel?
**Date of beer**
5/9/2012
5/9/2012
5/9/2012
5/12/2012
...
7/3/2012
You could make a pivot table. Date as a row field, Count of Date (i.e., count of beers) as a data field. Group the row field Date by 7 days to get weekly totals.
You'd probably be better off with a two column spreadsheet. Column A = Date; Column B = Number of cans. Then you could easily just make a line graph from that.
If you already have a large amount of data in your format you can use excel's subtotal function to create the two column format for you.
First i would put a formula in to get a week number for each date, and then use a count if for each week of the year.
This formula will assign each day of the year the week number of the year it falls in. Put this in each cell next to your dates.
=IFERROR(1+INT((AF12-DATE(YEAR(AF12+4-WEEKDAY(AF12+6)),1,5)+WEEKDAY(DATE(YEAR(AF12+4-WEEKDAY(AF12+6)),1,3)))/7),0)
Once that is done create a column of numbers 1-52 (53 for leap year) and do
=countif(rangeofcalcdweeknumbers,week1to52)
and copy that down for all 52 or 53 weeks
Then make a graph based on the final two columns

Excel to specify the month to report the data

Using excel, is it possible to specify the month to report in a cell?
For example, excel would need to report the latest reported sales, if its available. If the month of February sales is not available, then it will report January sales. Likewise, if March sales is available, it would report the sales in March.
How do you write this formulae in a cell in excel? If its not possible to write such a formuale, can we write a vba to do this?
If you mean you have a list of sales entries and want the sales for the last month in the data, you could write one formula to get the latest month. If months are in A you could write: =month(max(A1:A99999))
Note if you have multiple years data, you need to pull the year too or get bounding dates. You can then sum sales using an array formula like assuming the result of the first action is in D1 and sales are in B: {=sum(if(month(A1:A999999)=D1,B1:B999999,0))}
If you have incremental updates during the month, this will return month to date data. If you need data for the last full month, you can use another array formula to get the maximum month where the date is the last day of the month.
If the cells for future data in B1:B12 are blank then you just need to extract the last number in B1:B12 don't you? If so then try
=LOOKUP(9.99E+307,B1:B12)
You can use the OFFSET function to select specific data based on the month.
Insert a formula to calculate the current month (or just type in the month number)
=MONTH(TODAY())
The formula to select the current months of sales data
=SUM(OFFSET(B1,MONTH(TODAY()),0,1,1))
Have a look at the help in Excel on the OFFSET function. It can be used to select a range of data. For example, to return data from the start of the year to the current month the formula would be:
=SUM(OFFSET(B1,1,0,MONTH(TODAY()),1))
If the current month does not contain data yet, you can test to see if a value is returned and revert to the prior month if there is no data.
=IF(SUM(OFFSET(B1,B16,0,1,1))=0,SUM(OFFSET(B1,B16-1,0,1,1),SUM(OFFSET(B1,B16,0,1,1))))
I found this answer:
=IF(B12<>0,B12,IF(B11<>0,B11,IF(B10<>0,B10,IF(B9<>0,B9,IF(B8<>0,B8,IF(B7<>0,B7,IF(B6<>0,B6,IF(B5<>0,B5,IF(B4<>0,B4,IF(B3<>0,B3,IF(B2<>0,B2,IF(B1<>0,B1,0))))))))))))
This formulae solves the problem of picking up the latest available data.

Resources