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

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.

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

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

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.

Lookup using multiple columns and values

I have a sheet filled with data like below:
Gender MS Age Value
Male Married 21 1
22 2
23 3
24 4
Male Single 21 5
22 6
23 7
24 8
Female Married 21 9
22 10
23 11
24 12
Now there's this other sheet where the user will only be inputting the column "Gender", "MS", and "Age" values and the excel formula should be fetching the associated factor. Please help me with one such formula.
For e.g. If the user puts Male, Single and 23, the formula should return 7.
Here is an example on your sample data:
Formula in G4:
=INDEX(D1:D13,MATCH(1,(ROW(C1:C13)>=MATCH(1,(A1:A13=G1)*(B1:B13=G2),0))*(C1:C13=G3),0))
Enter through CtrlShiftEnter
You can use an array formula for this. I am assuming the blank data under Gender and MS are filled in.
=INDEX(Sheet1!A:D,MATCH(1,(Sheet2!A2=Sheet1!A:A)*(Sheet2!B2=Sheet1!B:B)*(Sheet2!C2=Sheet1!C:C),0),4)
After entering the formula, don't press enter! It is Ctrl+Shift+Enter to make this an array formula.
The formula given compares the values in cells A2, B2 and C2 of Sheet2 with the data held in columns A to D of Sheet1, and outputs the value of the fourth column of the appropriate row.

How to Drag a formula in Excel both across the columns and rows?

I have an Excel 2007 file with 2 sheets. The first sheet has 2 columns: one of dates, one of numbers like so:
1/1/2017 37
1/2/2017 82
1/3/2017 96
...
The second sheet has is to store the numbers in a "Calendar-like" fashion, like so:
SUN MON TUE WED THR FRI SAT
1/1/2017-1/7/2017 37 82 96 23 54 25 97
1/8/2017-1/14/2017 49 76 65 13 12 14 96
...
I am filling the "Calendar" style sheet from the much larger "List" style sheet. These go on for years, so I need a simple way to fill the "Calendar" style sheet from the plain list. I can use the simple formula of =sheet1!D7 to get from one sheet to the other, but I can only drag that formula in one direction... I can start it on Sunday, Jan 1 and drag it the whole way to Saturday, Jan 7, but if I try to drag the formula from that row to the next, it tries to insert starting with Jan 2 instead of Jan 8:
SUN MON TUE WED THR FRI SAT
1/1/2017-1/7/2017 37 82 96 23 54 25 97
1/8/2017-1/14/2017 82 96 23 54 25 97 61
...
Can I get these values from the list-type sheet to the calendar-type sheet without typing the formula in for each and every cell?
Not sure how your data is laid out, but if you adjust the range, this index/match should work:
=INDEX($B$1:$B$31,MATCH(DATEVALUE(LEFT($E3,SEARCH("-",$E3)-1))+COLUMN()-6,$A$1:$A$31,FALSE))
Note: I have one magic number in the formula, a 6. This is because this is where your "Sun" column starts. If you put your formula in any other column, adjust that number. Alternatively, you could get fancy and add logic looking for "Sun" in some array, but thought that's a little overkill.
You can drag this formula over and down.

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.

Resources