Excel function for indexing and matching multiple criteria - excel

Say I have the following column headings filled with data on Sheet2:
| Station number | Year | Month| Rainfall (mm) |
XX1 1995 1 30
XX1 2005 4 50
XX1 2004 5 70
...
And the following columns on Sheet1:
|Year | Month of Max | mm | Month of Min | mm |
2004
2005
2006
...
I have the following code under the "Month of Max" column:
=INDEX(Sheet2!B2:B10000,MATCH(MAX(Sheet2!D2:D10000),Sheet2!D2:D10000,0))
However, I want to match the years too (i.e. the year in Sheet1!A2 should match the year in Sheet2!B2:B10000 for looking up the maximum rainfall). I can't figure out where to put this function and keep getting errors. Sorry if this is obvious or has been asked before, I'm just very stuck!

MATCH is not suited to matching multiple creiteria. An alternative is this
=MAX(IF(Sheet2!$B$2:$B$10000=Sheet1!A2,Sheet2!$D$2:$D$10000,""))
enter as an Array Formula (press Ctrl-Shift-Enter rather than just Enter)
The IF part returns an array, with entries for non-matching years set to a null String. MAX then gets the maximum value of that array

Related

Formula for Data Comparison

I am looking for a formula that will populate a cell based on yesterday's day value for last month.
Please see my example:
Prior Month Comparison | | |
5-Jul | 5-Aug |4-Aug | 5-Jul
Total Number of Records: 10 | 25 | 7 | 10
Total Records Sold: 5 | 3 | 0 |... 5
I have all of July records to the right of my August records. I might have to use arrays so I'm not sure what would be the best approach.
I have looked into index/match but I'm not sure how to best apply this formula. I am available to any formula that will help me fill out my Prior Month Comparison column.
Thanks!!
Use HLOOKUP:
=HLOOKUP($B$1,C:E,ROW(),FALSE)

Excel countif and sumif together

I am trying to write a formula in Excel which will count how many times we have sold less than 50 of a particular product. For example, here is a day's sales:
Order | Product | Qty
1 | A | 5
2 | A | 5
3 | A | 5
4 | B | 30
5 | C | 75
I want a formula in a cell which says how many times we have a requirement for less than 50 of a certain product. So in the example above, there is a total of 15 As, 30 Bs and 75 Cs, so 2 of those are less than 50.
I think it will need to be an array function of COUNTIF and SUM, but can't figure it out.
You could use this formula:
=SUMPRODUCT(--(IF(ROW($B$2:$B$10)=MATCH($B$2:$B$10,$B$1:$B$10,0),SUMIF($B$2:$B$10,$B$2:$B$10,$C$2:$C$10),"")<50))
Note: It's an array formula and must be entered through Ctrl+Shift+Enter
Product order placement can be randomized and does not have to be in order.
Another way
=SUMPRODUCT((SUMIF(B2:B10,B2:B10,C2:C10)<50)/COUNTIF(B2:B10,B2:B10))
Maybe something like that will help:
=SUMPRODUCT(--IF($B$2:$B$11<>$B$1:$B$10,SUMIF($B$2:$B$11,$B$2:$B$11,$C$2:$C$11)<50,0))
Note that this is an array formula so needs to be entered with Ctrl+Shift+Enter. Data needs to be sorted by Product (i.e. product A cannot appear in random rows, like row 2, 20 and 100; it needs to be grouped together).
Result:

Excel: Average of parts of a column based on another column

Using Excel 2011 for mac, I have three columns: ID, Start date, end date and time to completion. (Date format: dd/mm/yyyy)
ID | Start | End | Time
1 | 01/01/2016 | 05/01/2016 | 4
2 | 04/01/2016 | 08/01/2016 | 4
3 | 01/02/2016 | 14/02/2016 | 13
4 | 02/02/2016 | 20/02/2016 | 18
5 | 01/03/2016 | 05/03/2016 | 4
6 | 06/03/2016 | 08/03/2016 | 2
7 | 12/03/2016 | 15/03/2016 | 3
Column D is basically the difference between column C and column B.
Now I have the total average, which is easy to calculate but I'd also like to have the averages for the different months.
And this is where my knowledge falls apart. I've tried several things but I can't seem to figure out how to calculate an average using only the cells in a column that match a certain value in another column. I could sort the tickets by date and do it manually by doing the average for only a certain range but as this list constantly changes this is definitely not a nice option.
Check out the AVERAGEIF function
AVERAGEIF(selection_range, criteria, averaging_range)
It uses the values in the selection_range to filter which values in the averaging_range will be averaged.
In your case you could say AVERAGEIF(B1:B8, "01/01/2016", D1:D8)
There are multiple ways. I would personally use an array formula, but that may be a bit advanced and overly complicated.
I suggest adding a column E "Month" - into E2 add:
=MONTH(B2)
Then copy cell E2 to E3:E8.
Now you can easily get a monthly average by applying the AVERAGEIF command:
=AVERAGEIF(E2:E8,2,D2:D8)
The second argument, 2, indicates February, but may be exchanged with any number from 1-12.

MS Excel - finding the first row after a certain date

Say I have a spreadsheet with the following, and for convenience say all of this starts from cell A1.
---------------------------------------
| Date | Item | Account |
---------------------------------------
| 01/09/2011 | Testing 1 | USD |
| 03/09/2011 | Testing 2 | USD |
| 11/09/2011 | Testing 3 | USD |
| 20/10/2011 | Testing 4 | JD |
| 22/10/2011 | Testing 5 | JD |
| 25/10/2011 | Testing 6 | USD |
| 03/11/2011 | Testing 7 | USD |
| 05/11/2011 | Testing 8 | JD |
---------------------------------------
Now, I want to run a report for a month, starting on 1/10/2011 and ending on 31/10/2011. I need to find the first row on or after the starting date, and then get every subsequent row until the end date. If I can figure out how to get the row reference for the first and end dates, then I can figure out the rows in between (obviously!).
I have only been able do these sorts of matches on exact matches ie. no idea how to do 'greater/less than' matches.
How would I go about matching on both the date and the account columns?
Needless to say, this needs to be in a formula.
=match(date(2011,10,1),a2:a9,1)+1
=match(date(2011,10,31),a2:a9,1)
First formula shows row for the first record for October, second formula for the last day. Data must be sorted in ascending order.
Use the following Array Formula for finding the Row containing the earliest date, which is equal to or greater than the date mentioned in cell C1 (in your case this is 1 October).
=MATCH(MIN(IF($A$1:$A$30>=C1,1,9999)*$A$1:$A$30),$A$1:$A$30,0)
Date list is in cells A1 to A30. Change the references as required.
Data need not be sorted in ascending or descending order.
Use the following Array Formula for finding the Row containing the latest date which is equal to or less than the date mentioned in cell D1 (in your case this is 31 October). Data need not be sorted in ascending or descending order.
=MATCH(MAX(IF($A$1:$A$30<=D1,1,0)*$A$1:$A$30),$A$1:$A$30,0)
If you want the earliest and latest dates, use the following Array Formulas.
=MIN(IF($A$1:$A$30>=C1,1,9999)*$A$1:$A$30)
=MAX(IF($A$1:$A$30<=D1,1,0)*$A$1:$A$30)
All the formulas used above are Array Formulas. To enter an array formula, use Control+Shift+Enter instead of Enter.
Vijaykumar Shetye, Goa, India
I would recommend using a pivot table for this. Look at the second link on in the "Excel Templates - Pivot Table" section on this page on the Contextures site.

excel - calculate date based on number of hours / planner

I'm trying to figure out how to auto generate/populate a column in excel based on the number of hours filled in another column:
Start date: 04-08-2011
Hours in one day: 8
Issues Hours Date
part 1 | 2 | 04-08-2011
part 2 | 6 | 04-08-2011
part 3 | 2 | 05-08-2011
part 4 | 2 | 05-08-2011
part 5 | 8 | 06-08-2011
part 6 | 2 | 06-08-2011
So when i add issue 'part 1' the date starts # the start date, when i add hours or 'parts' it continues to use the start days until it reaches 8 hours and continues to the next day.
Also when im adding a row between the existing rows it automatically recalculates the dates.
Anny ideas where to start? Tnx
If I understand what you are asking correctly, and assuming start date is in Cell B1, and hours in 1 day B2
And data header in A4:C4, with data below
Then put the formula '=$B$1+INT(SUM($B$5:B5)/$B$2-0.1)' in C5
Copy C5 down and it should generate the date automatically
The '-0.1' is to account for exactly 8 hrs being allowed in 1 day

Resources