Sum Total QTY of Widgets - excel-formula

I would like Cell E11 to be a "Smart Cell" that can SUM the total QTY of only items that match a catalog of items
In this example I'd like a formula that will SUM the QTYs of only a certain list of items. .
Example - what would be a formula for cell E11 that would only SUM the cells from the QTY column if the ITEM matches with either an HDU5, and/or HDU2, and/or, A35, and/or 298? In this case that would equal 11 - I don't know how to make that actually happen
I would like the "catalog" of ITEMS that I want their QTYS summed to be part of the formula itself for easier maintenance purposes.
Thank you for your help

SUMPRODUCT a SUMIFS():
=SUMPRODUCT(SUMIFS(A:A,D:D,{"HDU5","HDU2","A35","298"}))

Related

Formula for price breaks in Excel

I am trying to create a calculation table for prices based on QTY and price break tier. I have an IF formula that doesn't seem to be working correctly and could use some help! Below I will post a screenshot of the table, the formula I am using, and amplifying details:
Price Break formula: =IF(H3<=24,C3,IF(25<=H3<=99,D3,IF(100<=H3<=499,E3,IF(500<=H3<=999,F3,IF(1000<=H3,G3)))))*H3
Amplifying Info: Column "H" is derived from a sum of "J:P". What I want to do is automatically calculate the total quantity requested (Column "H") and based off of that value calculate the total price of each item in Column "I". IE if the total QTY=1 the price would be 1xC (Associated cell C3:C14); If the QTY=600, then it would be 600xF. Currently the formula only works if I manually input "1" as the QTY and no other numbers work. Column "H" is set as number (though general did the same thing). If i place any other number or what the calculation comes out to it puts a dash as shown in the picture.
I'm not sure if there is better way to do this with VLOOKUP or another function?
Try using MATCH and CHOOSE:
=CHOOSE(MATCH(H2,{0,25,100,500,1000}),C2,D2,E2,F2,G2)*H2
The MATCH will compare the qty (in H2) to the values in the array ({0,25,100,500,1000}) and return a number (1 to 5).
The CHOOSE will then take this number and choose the nth value from the list of cells (C2,D2,E2,F2,G2)
We then multiply the value in the chosen cell by the quantity in H2

Aggregating data using INDEX MATCH MATCH or SUMIFS

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.

Programmatically filling Excel column with all possible sums of two value combinations

I'm trying to fill a column with the number of calculations depending on a number provided as an argument. For example, if I plug in that I need to buy 50 widgets from two possible widget types:
Widget 1: $1.00
Widget 2: $1.15
I would like to be able to fill a column with 50 different values, each being the total price for 50 "widget 1"s, the total price for 49 "widget 1"s and 1 "widget 2", etc. Here's an example showing a spreadsheet for the total price for the first possible combination:
The idea being that just by changing B4/X in the spreadsheet, I can get the sum for each combination of widgets for X widgets total, with each sum being in its own cell. I have the beginnings of a formula to calculate this that seems like it might work for iterations of the different widget 1/2 mixes, but the B4 value is hardcoded and I also don't know how to carry the formula down column C the same number of times as the value in B4. Is VBA likely my best bet here?
=((50+0)*B2)+((50-50)*B3)
You may use the ROW() function like this:
=IF(OR(ROW()-ROW($C$2)<0,$B$4<ROW()-ROW($C$2)),"",(($B$4-(ROW()-ROW($C$2)))*$B$2+(ROW()-ROW($C$2))*$B$3))
You have to pull it down as long as the maximum possible value of B4. If B4's actual value is smaller than the maximum, the formula will result in empty strings.
Similar to z32a7ul's answer, but maybe a little shorter:
=IF($B$4+2-ROW()>=0,($B$4+2-ROW())*$B$2+(ROW()-2)*$B$3,"Out of Bounds")
The formula 1) checks if you exceeded the number of possible combinations of the widget summation and 2) pastes the sum if you haven't or 3) writes "out of bounds" if you have. Start in row 2 (e.g. cell C2) and pull down.
The formula assumes a) that you start in row 2 (otherwise, change every 2 in the formula to the row in which you start).
The widgets prices are in cells B2 and B3 (otherwise change the reference, and keep the $ signs, so when dragging the formula down, the references are kept)
The number of combinations is in B4 (again, adjust if necessary)

Excel: IF statement with ISBLANK over a range

I have a two columns, one with prices and one with the word "yes" or blank.
With this I also have a simple sum for my total cost. I am looking to create an expression that IF the value in column C is yes (or inversely if it is blank), to subtract its corresponding price in column B from the total to come up with the amount left over still.
Thanks for the help.
Assuming that you want to sum the blanks and then minus the "yes"s from that:
=SUMIFS($B:$B, $C:$C, "")-SUMIFS($B:$B, $C:$C, "yes")

Excel: Multiply each cell in row X by corresponding cell in row 2, and get sum

I have a table set up as follows:
Column 1 - Customer Name
Row 1 - Item Name
Row 2 - Item Cost
Row 3+- Item Quantity
How do I set up the last column to calculate the total cost for each customer? I.e, For each customer row, I want to multiply the number in each cell (= quantity) by the corresponding cell in Row 2 (= cost), and add them all up for the final bill.
To clarify what I'm saying I'm attaching the following picture so that we can discuss specifics.
Have you tried SUMPRODUCT - it does exactly what you need, gives the sum of 2 or more multiplied ranges?
=SUMPRODUCT(A71:C71,$A$2:$C$2)
You can extend the ranges as far as you need. If you want to add columns make sure you don't add at the end, e.g. if you retain one blank column (D currently) and include that in the formula, then if you add a column at D the formula will automatically extend to E
You can use sumproduct but specify the ranges, e.g. =sumproduct(B2:B6,C2:C6), the next row would then be =sumproduct(B2:B6,D2:D6) etc. I'm sure there's a way to "fix" your cost row but it's quite quick doing it this way
If, for example, your first data set is in column A (i.e. per unit cost) and the second data set is in column B (i.e. quantity), and you want the total cost for each item for the specified quantity, place the following formula in C1
=A1*B1
Select C1 and drag the fill handle - this is the small
black square at the bottom right corner of the cursor as far down the column as you need. The program will automatically replicate the formula with the correct cell numbers for each row.
One way is to use this formula:
=SUM(B4:B5)*B2+SUM(C4:C5)*C2
It is not so cool but you still need to expand the formula even with SUMPRODUCT because the range has to be the same as far as I know.
The other way I came up will use a matrix function called MMULT and here is the example:
With this array (means you have to click Ctrl + Shift + Enter altogether) formula entered into cell D6: =SUM(MMULT(B2:C2,TRANSPOSE(B3:C5))), you will get your expected result without needing all the subtotals. Please note this is a 2 x 1 By 2 x 3 Matrixformula.

Resources