In my data source I have a column that contains the Dates of occurrences and a Column that contains the Hour of the same occurrences.
With this, the goal is to obtain a punchcard plot (maybe the bubble chart will be the most appropriate)
The intermediate structure has the weekday(Sunday-Saturday) as rows (A2:A8), and the hours (8-22) as Columns (B1:P1), as each column must have the occurrence count for a week day in an hour.
With this said, I tried to use the COUNTIFS function, using the following approach, for the cell B2:
=COUNTIFS(WEEKDAY(RawData!T2:T9852;1);A2;HOUR(RawData!U2:U9852);B1)
However, Excel is not computing the value, finding a problem on the formula, having also tried using the Insert Formula Option.
place the following in B2
=SUMPRODUCT((WEEKDAY($T$2:$T$8,1)=WEEKDAY($A2,1))*(HOUR($U$2:$U$8)=HOUR(B$1)))
you will need to convert the , to match the ; on your system
In your range A2:A8 enter a known date for monday such as 2017/08/20. Then select A2:A8 and apply custom formatting for the number format and set it to ddd. This will display the day of the week in text but keep the value in the cell a number.
Adjust the ranges to suit your data.
Copy the formula to fill in your table.
Related
So, I am working on a loan payoff sheet and I wanted my excel sheet to be automatically updating.
One of my questions was answered when I searched how to select data corresponding to today's date using the function VLOOKUP(TODAY(),A:B,2,0) but that will only respond data in the column adjacent to today's date.
I would like to sum the data in the column of daily interest from the start date (provided) and have it automatically update for today's date. Attached is a snapshot of what I am trying to describe.
I currently have the dates stretched out several months in the future and am just summing the entire column of daily interest values.
If anyone knows how I can choose a start date of the first day and then automatically sum the values of the dates in between that would be fantastic.
Assuming Column A is your Date column and its the only numbers in the column you can use:
=MIN(A:A)
Having said that normally charts like this are built by a start date provided in a cell somewhere. If you can find that cell, simply link to it instead.
In order to get your sum of only appropriate dates, you will want to look at the formula SUMIFS. This will allow you to have multiple criteria that all have to be true. Assuming your interest is in column C you might be able to use the following formula:
=SUMIFS(C:C,A:A,">="&MIN(A:A),A:A,"<="&TODAY())
'Substitute your direct cell link for MIN(A:A) if you have it
Basically
=SUMIFS(Range to sum, range to check 1, criteria for check 1, range to check 2, criteria for check 2)
If for some reason you have data above and below your dates and interest column, you may need to adjust your ranges from A:A to A5:A678 where 5 is the first row of your data and 678 is the last row of your data.
With dates in column A and value in column B, place the start date in C1 and the formula:
=TODAY()
in C2. Then in another cell enter:
=SUMPRODUCT(--(A1:A9999<C2)*(A1:A9999>C1)*B1:B9999)
This formula give the sum of values between the date limits (not including).
The formula does not require the dates in column A to be in sorted order.
I am trying to count ยจ"the number of stops during each month", and then place them in another table that contain the header as the months (Data Format).
I tried many formulas, in E5:
=COUNTIFS(A:A;"=GRP 1";MONTH(B:B);"=1")
=COUNTIFS(A:A;"=GRP 1";MONTH(B:B);=1)
=COUNTIFS(A:A;"=GRP 1";MONTH(B:B);"MONTH(E4)")
The error message is the following:
Any one has an idea?
Thanks
The criteria_range argument for the COUNTIFS function generally needs to be a range, and not an array. Hence your formula will fail.
You can use a Pivot table.
Drag the Group Number to the rows area
Drag Date of Stop to the Columns area
Drag Date of Stop to the Values area
Format as desired
For a formula solution, you can use SUMPRODUCT. You have to exclude the first row, or add an additional criteria as text entries will result in a #VALUE! error
E5: =SUMPRODUCT(($A$2:$A$200=$D5)*(MONTH($B$2:$B$200)=MONTH(E$4)))
Note that in your results table, the Date row are real dates formatted to show as they appear.
Or, if your data is in a table, you can use structured references.
=SUMPRODUCT((Table1[[Group Number]:[Group Number]]=$D5)*(MONTH(Table1[[Date of Stop]:[Date of Stop]])=MONTH(E$4)))
Edit:
As an exercise, it is possible to use whole column references, as shown in the formula below which tests to ensure that the column B entries are dates.
However, this will significantly increase calculation times, and is rather inefficient. You are much better off avoiding this by:
Excluding Row 1, or
Using a dynamic range reference, or
Using a Table with structured references
=SUMPRODUCT((IF(ISNUMBER(B:B),A:A,0)=$D5)*(MONTH(IF(ISNUMBER(B:B),B:B,0))=MONTH(E$4)))
Since this is an array formula, you need to "confirm" it by holding down ctrl + shift while hitting enter. If you do this correctly, Excel will place braces {...} around the formula as observed in the formula bar
New code.
Think we will have to use EDATE for this formula. For cell(E5) try the following.
=COUNTIFS($A:$A,"GRP "&RIGHT($D5,1),$B:$B,">="&E$4,$B:$B,"<"&EDATE(E$4,1))
Basically EDATE allows you to get the same date (e.g 1st of the month) as many months in advance a you need. In this case, we set EDATE to 1 month in advance.
I have an excel file. I don't want to write any VBA code, as I don't necessarily want to run a macro for the process to work; I want it to automatically update information as I change one cell (the "Date" cell on the second sheet/photo).
So, basically I have a tracker that I will use to determine for any given date, how many tasks do I have issued to each company (military companies for context). It'll help me understand who has the least amount of tasks in general and what percentage of every company is dished out to tasks. I have a tracker of those issued tasks that looks like this:
My next tab looks like this:
It uses a COUNTIF (COUNTIF(all cells in that day's column on the first sheet/photo except the header, "Company's name")) to determine how many tasks any company has within that day; that's the "RAW" number. The "PERCENT" divides the "RAW" number by how many total people they have in the company; it already works as needed. My goal is to type in a date into the cell beneath "Date" and have the cells to the right of "RAW" automatically inform me for that date typed in. The "PERCENT" already does its magic.
I just don't know how to have the "RAW" cells' formula reference all cells underneath a date on the first sheet/photo after typing that date into "Date" on the second sheet/photo. I was considering an offset, but I'm not sure how to offset a range from the formula of another cell: A2:1000 if the formula of another cell [Date] references A1, and have those RAW cells reference change to DC2:1000 if that Date cells value or reference changes to DC1.
Use MATCH to find the date in the row of dates and insert this into OFFSET, as the COLUMNS argument, to say how many COLUMNS to the right you need to move, to count over the correct range for the selected date.
Say you had your selected date is in Sheet1!D2:
And your companies' tasks in sheet2, with the dates from column B1 onwards, and company HHC spans rows A2:A7:
You want to find the column containing the selected date using:
=MATCH(Sheet1!D2,Sheet2!1:1,0)-1) 'returns 9
The adjustment of minus one is that dates actually start in column B not A in row 1.
You know HHC spans Sheet2!A2:A7, in this example, and you now know you want to move 9 columns to the right of this to do your count.
Using OFFSET and the columns argument (9) yields Range J2:J7
OFFSET(Sheet2!A2:A7,,MATCH(Sheet1!D2,Sheet2!1:1,0)-1)
Inserting this into your COUNTIF, as the source range, with "HHC" as the criteria:
=COUNTIF(OFFSET(Sheet2!A2:A7,,MATCH(Sheet1!D2,Sheet2!1:1,0)-1),"HHC")
This is then the formula that would go in cell Sheet1!C1 next to RAW.
The same principles apply to your other companies. Define the start range for the company, use MATCH to determine the number of columns to OFFSET by, and then wrap it all in a COUNTIF.
A match being found depends on:
Date being present in search range;
That dates are of the same datatype in both sheets (i.e. dates in both sheets or strings in both sheets).
I am looking to create and IF function that does the following.
There is a ton of data with one column containing dates. I want and if functions that labels each row according to the following.
If date falls between 0-30 days of todays date in the past then label "GOOD" (so if todays date is 21/09/2017 then it should be labelled as "GOOD" should it falls between the dates 21/09/2017 and 21/08/2017)
If date falls between 31-60 days of todays date in the past then label "FAIR"
If date falls between 61-90 days of todays date in the past then label "ATTENTION"
If date falls between 91+ days of todays date in the past then label "CLEARANCE"
Hope someone can help.
Many thanks
Use
=IF(TODAY()-A2<31,"Good",IF(TODAY()-A2<61,"Fair",IF(TODAY()-A2<91,"Attention","Clearance")))
Column D shows the difference between today date and cell date.
Alternative Answer
Use VLOOKUP to potentially ease your future formula maintenance. In an unused location, set up a table that has your break point ranges and associated return values. For this example I used the following:
Technically speaking column G is not required, but it can be easier for some people to read.
Now assuming your dates are in Column A, you can use the following formula in B2 copying down:
=TODAY()-A2
and in C2 use the following look up formula and copy down to get your desired results:
=VLOOKUP(B2,$F$3:$H$6,3,1)
now if you are not keen on generating the extra column for calculate the number of days, you can substitute that first formula into the second to get:
=VLOOKUP(TODAY()-A2,$F$3:$H$6,3,1)
place the above in B2 instead and copy down.
The following is an example of the first approach:
The main advantage to this approach is you can manipulate the lookup table easily changing breakpoints, wording of results etc easily without touching your formula (when done right)
if you have the potential for negative days, instead of returning an error, you could wrap the lookup formula in an IFERROR function to give a custom message or result.
=IFERROR(VLOOKUP(B2,$F$3:$H$6,3,1),"In the Future")
Assuming your data starts with A2, A3 and so on.. as below
Apply the below formula in B2 and drag down up to A8
=IF(AND(--TEXT(TODAY()-A2,"##")>=-1,--TEXT(TODAY()-A2,"#")<30),"GOOD",IF(AND(--TEXT(TODAY()-A2,"##")>=30,--TEXT(TODAY()-A2,"#")<60),"FAIR",IF(AND(--TEXT(TODAY()-A2,"##")>=60,--TEXT(TODAY()-A2,"#")<90),"ATTENTION",IF(--TEXT(TODAY()-A2,"##")>90,"CLEARANCE","FUTURE DATES"))))
Good afternoon! I'm trying to get a Countifs or Index Match statement to count the number of times a value occurs in another table. The example:
On my report sheet, Column A contains 10 different statuses, such as Green, Yellow, Red etc.; Row 1 contains six dates, such as 1/31/2015, 2/28/2015, etc. These dates are calculations. The last date references my date worksheet and the five other use EOMONTH to get the month end for the five prior months.
On my data table, I have 7 descriptive columns (such as Type, Make, Model, etc) and then we begin date columns: 1/31/2010 all the way to 7/31/2015. I add a new column each month (I know, I don't like it either, but unfortunately we don't have a time series database).
What I need to do is have a Countifs or Index Match that pulls the date from my report tab, goes and finds it in the header row of my tblTrends, and then counts all those statuses that are Green, and if it's a SUV (for example).
Thoughts?
Thx!!
G
At it's most basic, you'd want something akin to:
=COUNTIFS(TypeRange,"SUV",FirstMonth,Status)
So let's say your data table starts in column L, and the first date column is O:
=COUNTIFS($L$1:$L$100,"SUV",O$1:O$100,A$2)
As you drag this formula across the different dates, it will move the date reference over one to the next month.
If you need it to dynamically determine the date column, I'd recommend OFFSET, which dynamically select a range. However, note that OFFSET is a "volatile" formula, which means it re-calculates anytime a change is made anywhere in the file, which can lead to pretty slow load times if not used sparingly.
=COUNTIFS($L$2:$L$100,"SUV",OFFSET($N$2:$N$100,,MATCH(B$1,$O$1:$Z$1,0)),$A2)
The OFFSET starts on column N, because that's the first column before the columns we want (the date columns). The MATCH tells it how many columns to OFFSET from here.
If you're going to use this over a large amount of data, then you could avoid using the OFFSET formula by creating a dynamic table. This table would only contain data for the six months you're interested in, by utilizing INDEX/MATCH, and you could run your COUNTIFS off this table, instead, using the original, basic method I first described. I can go into detail if you're unsure what I mean.