How to COUNT between a date range if nested within another formula? - excel

I am trying to substitute '!!!!!!' for a formula to count the number of W in column P on sheet TRADE LOG between the dates of 01 Feb 2021 and 28 Feb 2021 in hardcoded format.
This is the current formula :
=IF(COUNTIFS('TRADE LOG'!P:P,"W",'TRADE LOG'!B:B,">="&DATE(2021,2,1),'TRADE LOG'!B:B,"<="&DATE(2021,2,28)),"!!!!!!","")
Could anyone suggest what needs to be added in order to achieve this?
To make this clearer, I want F16 in STATISTICS to count the number of W's in sheet TRADE LOG column P between the dates of 01 Feb 2021 and 28 Feb 2021. However, if there is none I would like F16 to return a blank.

Related

Excel - identify due date based on multiple frequencies of given dates

I have table of frequency with amount:
name start_date end_date frequency(M) Amount
A 11 Nov 22 11 Nov 23 6 220
B 15 Nov 22 23 Jun 23 3 500
and a date table. Is there anyway using Excel formulas to identify due dates of these frequencies and sum up all due amounts, like:
Date Amount
10 May 23 0
11 May 23 220
12 May 23 0
13 May 23 0
14 May 23 0
15 May 23 500
Thank you very much.
u can calculate the dates in the same row. the first date calculated would be referring to the start date and every subsequent dates to be calculated would be based on the previous date calculated
so, if your above first table is put in cells from A1 to E3,
the formula in cell F2 should read as: =IFERROR(IF(EDATE($B2,$D2)>$C2,"",EDATE($B2,$D2)),"")
and formula in cell G2 should be: =IFERROR(IF(EDATE(F2,$D2)>$C2,"",EDATE(F2,$D2)),"")
you will next need to pull formula in cell G2 towards right
and copy and paste formula in row 2 in row 3 onwards
to get sum of all the due amount you may next do a sumproduct function of the dates in formula and the amount column

What is the best way to use Index Match in this case?

In the primary worksheet, I have a list of employees in column A, from columns D:ZZ I have basically a calendar in row 11. Where these intersect, I have assigned a task code to each employee to illustrate what they are employed to do that day. I want to dynamically color the coded cell based on the date in the row 11 and code from the column that it was entered. In my second sheet, I have a table of the codes along column A. From columns B:AM, in row 2 (under the header) I have another code that says what type of work it is, in office, on the road, etc. This is the code I am trying to look up with Index Match. In the row with the task code, under each header I have a scheduled date that that particular job will be either in or out or nothing.
I can Index the task column pretty easily, my problem is how would I take the row I get from that, then search only that row for the date that I applied the code to the employee to return the result from row 2 and the column that that date appears?
I have a pretty good understanding of Index/Match in looking up multiple items to return a result. I am having a problem creating a range from a result to find the data I want.
I have tried Indirect and Address as well as Offset, but I don't want this to be volatile as it is being used in conditional formatting over several thousand cells.
Task Code Schedule Worksheet
DAY 1 2 3 4 ...
CODE A S A F ...
96T003 03 May 04 May 05 May 06 May ...
96T004 05 May 06 May 07 Jun 10 Jun ...
96T005 05 May 19 Jul 22 Jul 23 Jul ...
Primary worksheet
SAT SUN MON TUE WED
DATE 01 02 03 04 05
JONES OFF OFF 96T003 96T003 96T004
DAVIS OFF OFF 96T003 96T003 96T005
This formula works, but is "volatile" and I am leary to use it in a conditional formatting function. Is there a way to make it not as volatile?
=INDEX(CMP_FLYCODE,1,MATCH(F11,INDIRECT("'CMP'!"&ADDRESS(MATCH(F19,CMP_ADP,0),1)&":"&ADDRESS(MATCH(F19,CMP_ADP,0),40)),0))
CMP_FLYCODE is a reference to just the A, S and F code row
Expecting to return a letter code A, S or F based on the date and code
Edit: Added the header to the code schedule that is a unique number for the day of the task 1, 2, 3...
I don't think it's too bad, you can just get the entire row from the 2d array B3:E5 in the task sheet using index with the match for the task code in the row parameter and 0 in the column parameter, then match the date in that and use index again to get the required letter code.
This is what my formula looks like:
=IF(C3="OFF","",INDEX(Tasks!$B$2:$E$2,MATCH(C$2,INDEX(Tasks!$B$3:$E$5,MATCH(C3,Tasks!$A$3:$A$5,0),0),0)))
This is my primary sheet:
This is my task sheet:
So to use this in conditional formatting, you would need three rules using custom formulas
=INDEX(Tasks!$B$2:$E$2,MATCH(C$2,INDEX(Tasks!$B$3:$E$5,MATCH(C3,Tasks!$A$3:$A$5,0),0),0))="A"
=INDEX(Tasks!$B$2:$E$2,MATCH(C$2,INDEX(Tasks!$B$3:$E$5,MATCH(C3,Tasks!$A$3:$A$5,0),0),0))="S"
=INDEX(Tasks!$B$2:$E$2,MATCH(C$2,INDEX(Tasks!$B$3:$E$5,MATCH(C3,Tasks!$A$3:$A$5,0),0),0))="F"
with appropriate fill colours.

Excel formula to calculate YTD metrics by detecting current month

I have two excel tables - 2015 sales and 2014 sales in the following format. And a third table called Year over Year Variance which looks at % change in 2015 over 2014.
2015 Jan Feb Mar .... YTD (total)
Orders
Revenue
...
...
2014 Jan Feb Mar .... YTD (total)
Orders
Revenue
...
...
Variance Jan Feb Mar .... YTD
Orders
Revenue
...
...
Computing Jan variance over Jan or Feb variance over Feb is simple. How do I compute Year to date variance. Because the 2014 table is already populated for the whole year - so the last column is the sum of 12 months of data.
For 2015, I only have Jan and Feb. So the variance column for Year to date should be (Jan+Feb 2015)/(Jan+Feb 2014). How do I write a formula to check for the current month and then sum only those two months for the year to date calculation?
Using Excel formulas (no-VBA), you can couple the SUM, OFFSET, and COUNT functions to calculate the variance. In the simplified formula below, Row 1 is fully populated across all 12 months. Row 2 is only populated for 2 months. Using the COUNT formula across the range, the OFFSET will expand the width based on the number of populated rows.
Let me know if you have any problems adapting it.
=SUM(OFFSET($A$2,0,0,1,COUNT($A$2:$L$2)))/SUM(OFFSET($A$1,0,0,1,COUNT($A$2:$L$2)))
=Month(Today())
will return the current month (integer, 1-12) in the spreadsheet.
Month(Now)
will do the same thing in VBA code.
I'd use a formula in the 3rd table along the lines of
=if(Month(Today())<=Month(*date-of-column-header*), *Computed-Variance*, 0)
That way, you simply have zero show up in the cells where the comparison makes no sense, and your sum of the numbers in the row is unaffected.

add values for a range between reference date minus 6 days in excel

i would like to add the corresponding values of dates with reference to a particular date and -6 days in excel.
For example: reference date is 10th feb 15. I would like to add values under flight time column for dates ranging between 10th feb 15 and previous 6 days.
similarly add values for a reference date and previous 30 days values and 1 year values.
What i wanted was, sum all the flight timings of a particular date in column A. I used the sumifs formula to achieve this.
The formula is =SUMIFS($I$8:$I$1122,$A$8:$A$1122,"<="&C8,$A$8:$A$1122,">="&C8-6)
What it does: Here the reference cell is C8 which is 6th Feb 14
step 1- date range for the calculation is 6th feb 14 minus 6 days
step 2- add the values of column I which correspond to all the dates that fall within 6th feb 14 to 31st jan 14
step 3- indicate the sum in column K
Unfortunately i cannot include any pictures or files to show what i have mentioned due to site limitations.

How can I perform functions on a specified subset of rows?

I want to find the max (min, average, etc.) of a column but only for the subset of rows where another column matches a certain pattern.
For example, here is the data in the sheet named "data":
Date Value
Jan 15
Jan 17
Jan 3
Feb 19
Feb 34
Feb 37
Then in a separate sheet, "reports", I'd like to have:
Jan Feb
Max 17 37
Min 3 19
What function I can put in the cells in the "reports" sheet to get those values?
If it matters, I'm using Gnumeric 1.10.
To achieve:
=max(column b where column a == Jan)
You can use an IF to do that:
=MAX(IF(A2:A7="Jan", B2:B7))
This formula should be entered as an array formula however. In excel, you do this with Ctrl+Shift+Enter.

Resources