The Discount worksheet contains a two-dimensional table that has been set up to find the discount category of a ticket based on the weekday of travel and the fare category. In cell J3 of the Request worksheet, use the INDEX function to retrieve the discount category for this ticket, Copy down formula. I have =INDEX((Discounts!$A$4:$A$10,Discounts!$B$4:$D$10),4,2,2) but that isn't correct...First Table is Request TableDiscount Category Table
The syntax for the Index formula is:
(ARRAY, row num, column num)
Basically, an array is a rectangular shape of data. Row number tells excel whether to look in the 1st row, second row, third row, etc. Column num is the same thing for columns.
Your array should be Discounts!$A$4:$d$10
Let's say you're trying to find the discount for the first example (John Frasier)
Your row number is the day of the week, so it should equal h3.
Your column number is the fare category, so it should equal I3
Thus the whole formula should be
=index(Discounts!$A$4:$d$10,H3,I3)
Related
I'm trying to create an Excel formula that is able to sum multiple rows in a table, where the rows and column to be summed are determined by the contents of other cells.
Ordinarily I would use Index Match Match to achieve this, but the multiple rows summation has left me stumped.
I've seen a couple of examples on here of Index Match with a SUMIFS formula, but nothing that pairs this with Index Match Match.
I have two tables on different Excel sheets. The first one looks a little this (the actual table is 105 columns x 200 rows):
That is from a sheet called "Firm Cost Summary". Row 4 contains a list of unique employee numbers. Column A is the expense category per our accounting system and Column B is a broader category that should be used in Excel to group similar items. Column E onwards then contains the numerical information to be aggregated.
What I would then like to do is summarise that table in a more presentable format that can then be manipulated in other ways. The table looks like this:
That is on a sheet called "Staff Cost Summary". I would like to fill out the info in the yellow cells, i.e. total the salary, bonus, benefits, etc, of each staff member. Ideally this would be a formula I input in cell E6 that I can then drag right and downwards to fill the table.
To give an example, to fill out cell I6 in the second table, the formula should look in cell A6 to find the employee number (1 in this case) and look this up in row 1 of the first table to find the appropriate column of the first table (column E in this case).
The formula should then look in cell I5 of the second table to see that we are looking to aggregate benefits, then look down column B of the first table to find each row that should be summed (rows 7-10 in this case).
With that in mind, here's what I've got:
=INDEX('Firm Cost Summary'!$A$4:$G$10,MATCH('Staff Cost Summary'!$A6,'Firm Cost Summary'!$A$4:$G$10,0),MATCH('Staff Cost Summary'!E$5,'Firm Cost Summary'!$B$4:$B$10,0))
Total benefits for Joe Bloggs are the sum of cell E7:E10 of table 1, i.e. 5 + 10 + 50 + 100 = 165.
Clearly there are multiple matches in column B of that table, so the above formula gives an answer of 0. Any ideas how I can tweak that to make it work?
Put this in E6 and copy over and down
=SUMIFS(INDEX('Firm Cost Summary'!$D:$DD,0,MATCH($A6,'Firm Cost Summary'!$D$4:$DD$4,0)),'Firm Cost Summary'!$B:$B,E$5)
The index/match returns the correct column to be added.
This is my first post. Please see the attached Photo. The items highlighted in yellow is the criteria I'm trying to create.
I want to subtract the Extended Values (G-L) if the Buy is not optimal and the Price and Qty in cells columns D and F exist in the range of cells in columns J and K and the value in Column B = the value in Column R.
Below is the formula that works for some of the cases, but not all.
=IFNA(IF(AND(H7="Optimal Buy",P7="",IFNA(MATCH(D7,X:X,0),0)>0,IFNA(MATCH(F7,W:W,0),0)>0),G7-L7,""),"")
Formula Question:
I am trying to find the assigned tax rate for each individual based on the country and annual income from picture below by referring to 2.
Thank you!
=IF(OR(G6=0,G6=-1),0,INDEX(INDEX(TaxRates!D:D,MATCH(A7,TaxRates!A:A,0)):INDEX(TaxRates!D:D,MATCH(A7,TaxRates!A:A,0)+COUNTIF(TaxRates!A:A,A7)-1),MATCH(J7,INDEX(TaxRates!B:B,MATCH(A7,TaxRates!A:A,0)):INDEX(TaxRates!B:B,MATCH(A7,TaxRates!A:A,0)+COUNTIF(TaxRates!A:A,A7)-1),1)))
Assuming that
both worksheets start in column A
row 1 has column headings
formula starts in row 2 on People sheet
data in the TaxRates sheet is sorted ascending by country and then ascending by lower income
you may want to add a row for 0 to first lower bound for each country.
Read the formula from inside out. It first establishes a lookup range that goes from the first occurrence of the given country to the last row with the given country, then does an approximate match on the lower bound income for these rows.
=INDEX(INDEX(TaxRates!D:D,MATCH(A2,TaxRates!A:A,0)):INDEX(TaxRates!D:D,MATCH(A2,TaxRates!A:A,0)+COUNTIF(TaxRates!A:A,A2)-1),MATCH(I2,INDEX(TaxRates!B:B,MATCH(A2,TaxRates!A:A,0)):INDEX(TaxRates!B:B,MATCH(A2,TaxRates!A:A,0)+COUNTIF(TaxRates!A:A,A2)-1),1))
I am using following formula to calculate sum based on multiple sheets, here is the scenario
Total 2 sheets, Data and Translation,
In Data sheet i have employee name in C Column, Hours in J column,
In Translation sheet i have Department in A Column, Employee name in C column, and Rate in E column, so i have Department name, from that name i need to calculate total $ spent,
I have following formula, that will capture total rate (COUNTIF(H7,Translation!$A$2:$A$27)*Translation!$E$2:$E$27)
but its not calculating total hours (LOOKUP(IF(H7=Translation!$A$2:$A$27,Translation!$C$2:$C$27),'Data '!$C$2:$C$410,'Data '!$J$2:$J$410)
Please let me know
=SUMPRODUCT(IFERROR(LOOKUP(IF(H7=Translation!$A$2:$A$27,Translation!$C$2:$C$27),'Data '!$C$2:$C$410,'Data '!$J$2:$J$410),0)*COUNTIF(H7,Translation!$A$2:$A$27)*Translation!$E$2:$E$27)
You can't use LOOKUP here because the lookup range isn't sorted ascending - you can use SUMIF in place of LOOKUP, try this "array formula"
=SUM(SUMIF(Data!C2:C500,IF(B2=Translation!A2:A500,Translation!C2:C500),Data!J2:J500)*COUNTIF(B2,Translation!A2:A500)*Translation!E2:E500)
confirmed with CTRL+SHIFT+ENTER
Column A represents serial numbers of different parts, but these parts come from different suppliers so they have different prices. Column B holds the price for each part.
I need a macro that will essentially go down Column A, compare the column B price for duplicates, and return the min price for the part in column C.
Alternatively, you could:
Create a pivot table, selecting columns a and b as your source
Set serial number as a row field (drag it to the left of the table)
Set price as a data field (drag it to the middle)
Choose to display min of price rather than sum (the default)
Working out the formula was much more entertaining, though!
You can do this without even needing array formulas:
=SUMPRODUCT(($B$1:$B$5)*($B$1:$B$5=MIN($B$1:$B$5+(A1<>$A$1:$A$5)*MAX($B1:$B5))))
/SUMPRODUCT(1*($B$1:B$5=MIN($B$1:$B$5+(A1<>$A$1:$A$5)*MAX($B1:$B5))))
The important insight here is that you can do array operations inside a SUMPRODUCT, and inside functions inside a SUMPRODUCT. The first SUMPRODUCT gives the sum of all the prices that are equal to the minimum price for each component, and the second one gives the number of listings that have that price. Divide one by the other and you have the minimum price for each component!
First SUMPRODUCT:
($B$1:$B$5) is a column vector of your prices.
We're then creating another column vector whose entries will be coerced to 1 if the corresponding entry in $B$1:$B$5 is equal to MIN($B$1:$B$5+(A1<>$A$1:$A$5)*MAX($B$1:$B$5)) and zero otherwise.
The part inside the MIN function starts out as the original vector of prices, but if the serial number from each row of column a is not the same as the one in the current row, we add on the largest price from anywhere in column B to the current row in column B.
This prevents any parts with different serial numbers from being counted as having the minimum price while leaving all prices for the current part unchanged.
This means we've constructed a column vector where all the entries are either zero or equal to the lowest price for the component in the row of the cell in which the formula is entered.
The second SUMPRODUCT is similar to the first, except this time we just add up the number of times the condition is met without multiplying by the price.