I am using excel 365.
I want to get aggregated for each product how often it is used by the departments.
I tried =COUNTIFS($B$2:$E$18;$I$2) on the times, however I do not know how to get the products?
Any suggestions?
It is truly complicated. My solution made it even more complicated, since it accounts for the number of departments (assuming that's the only data in the entirety of row 1) and products (assuming that's the only data in the entirety of column A) and any number of data introduced, also assuming the fixed placement of your calculations as shown in the example picture. Here's the formula you need in I3:
=COUNTIF(INDIRECT("R"&MATCH($H3,$A:$A,0)&"C2",0):INDIRECT("R"&LOOKUP(2,1/($A$2:INDIRECT("A"&COUNTA($A:$A)+1)=$H3),SEQUENCE(COUNTA($A:$A),1,2))&"C"&COUNTA($1:$1)+1,0),I$2)
You need to drag it all over the calculation area. I wanted to do a single cell spill array formula, but I don't think it's even possible right now due to its limitations (it generates the array first, and spills afterwards, making it static).
Related
I have 2 columns one is a period and another is a cycle. I need to create a 3rd column where I create a cycle identifier. Where the Letter changes on the cycle but resets every period.
I seem to have it with the following formula
IF(A1<>A2,1,IF(B1<>B2,C1+1,C1)). Which will give results of 1, 2 or 3. Then to get the numbers into letter form by using a switch SWITCH(C1,1,"A",2,"B",3,"C") in an adjacent cell. However I was curious if there is a more efficient or better way to accomplish this perhaps in all in one formula.
Any suggestions would be greatly appreciated.
Period & Cycle
Copy this formula to cell C2 and copy it down.
=IF(B2<>B1,IF(A2<>A1,CHAR(65),CHAR(CODE(C1)+1)),C1)
In Excel 365, you could use a spill formula like this:
=CHAR(B2:B15-XLOOKUP(A2:A15,A2:A15,B2:B15)+65)
You could argue that this is less efficient because it uses a lookup so there could be a speed hit with large amounts of data. On the other hand, it could be considered more efficient because it is a single formula and doesn't need to be pulled down.
If you were worried about the speed, you could set the binary search option in xlookup:
=CHAR(B2:B15-XLOOKUP(A2:A15,A2:A15,B2:B15,,2)+65)
(Column A has to be sorted ascending for this to work - I'm fairly sure that where there are duplicates this will still give the first match. However Microsoft are quoted as saying that there is only a slight benefit of using binary search according to this and other articles)
You could make the formula more dynamic:
=CHAR(B2:INDEX(B:B,COUNTA(B:B))-XLOOKUP(A2:INDEX(A:A,COUNTA(A:A)),A2:INDEX(A:A,COUNTA(A:A)),B2:INDEX(B:B,COUNTA(B:B)))+65)
Or using Let
=LET(Period,A2:INDEX(A:A,COUNTA(A:A)),
Cycle,B2:INDEX(B:B,COUNTA(B:B)),
CHAR(Cycle-XLOOKUP(Period,Period,Cycle)+65))
I have created an excel sheet to have an overview over costs in my projects, however, I also need an overview of costs per category in my projects. I googled it and tried to find examples online, however, it only returns a value of 0, which shouldn't be the case. Can anyone help me? The sheet looks like below.
I am going by the SUMIF function to group by category but my excel sheet is a bit more complex than that so I tried to adjust it accordingly as seen in the code below. No matter what I do it either returns an error or 0.
=IF(B12=B8;"";SUMIF(B12:B39;B12;J12:BE39))
In the formula above I am trying to sum the costs of a category that could be written in B12, for example, Software development. For confidential reasons, I cannot show the actual filled out excel sheet.
sumif does not work with summing multiple columns. Instead use a sumproduct statement instead like so:
=IF($B12=$B$8;"";SUMPRODUCT(($B$12:$B$39=$B12)*($J$12:$BE$39)))
A detailed explanation to how this works can be found here
Edit:
I sense a follow up question coming, how to skip certain columns. Because as you have set it up now, it will count the entire range from J12 to BE39, in which you have both forecast costs and actual costs. I guess this is to compare the costs to what was projected and what the actual costs are. Right now it will count both the projected and actual cost, doubling up. To prevent this you can enter every second column separated by a + like so:
=IF($B12=$B$8;"";SUMPRODUCT(($B$12:$B$39=$B12)*($J$12:$J$39+$L$12:$L$39+$N$12:$N$39)))
Also I have added $ signs to all non-changing values so it will work when dragging down the fill handle on the formula to populate the below cells.
I am trying to get a dedicated material table in excel. So we have a few products and these products require particular materials. I know how much and which materials go in particular products. I also know how much is sold in which year, now I want to calculate the required materials for these years. Because the productbase is large (>100), and thus >100 columns, I would like to use some lookup or index function to automate the multiplication.
As shown in the picture, I tried using a sumproduct, which was also explained in some other question on stackoverflow. This sumproduct should multiply all values obtained in one table with the corresponding values in the other. I feel that something is not right about my first two match functions (see picture again)
The code used:
=SUMPRODUCT(INDEX($B$19:$E$22;MATCH(B$2;$A$19:$A$22;0);MATCH(B$10;$B$18:$E$18;0));INDEX($B$3:$E$5;MATCH($A11;$A$3:$A$5;0);MATCH(TRUE;$B$3:$E$5>0;0)))
The image contains some extra info and explanation of the actual need
The reason that it needs a lookup or index is because the products in table 3 are always in another order than what is shown in table 1.
I would like to have this sumproduct as automated as possible, thank you in advance:)
You could try and adapt the below:
Formula in B11:
=SUM(INDEX($B:$B,MATCH($A11,$A$1:$A$5,0)):INDEX($E:$E,MATCH($A11,$A$1:$A$5,0))*TRANSPOSE(B$19:B$22))
Entered as array, CtrlShiftEnter
Drag right and down into matrix.
Side-note: Be sure to edit your question to include all relevant information, including your own atempted formula, as text. Way easier to copy paste sample data that has been formatted as markdown :)
The situation: I have an automatic procedure for gathering data from different input-sheets and presenting in a pivot-friendly format. It appears others are in need of the same data, though they want it formatted slightly differently (and they are not friends with excel). I therefor have a version of my table formatted as they want it (with empty columns where my extract does not contain any data).
The table (both) is one line for each department for each year for each cost/income (from now, cost) category. The raw data contains the cost for each year, though some of the users want it to be cost delta from initial year. I want:
One column for raw cost (X). One column for delta cost (Y). One output column (Z) that contains one of those two values, depending on dropdown selection. The first two columns are situated to the right of the "select with mouse and copy these"-columns, so that I dont need to teach the other users how to select non-adjecent columns :P (just letting u know the level of understanding i have to work with here)
Now the naive approach to this would be to have an if-statement in column Z like this:
=IF(selected_Calc="Use raw cost";[#[X]];[#[Y]])
Alternatively nest more ifs (one for "Use difference to 2019", and potentially add more nesting if more ways to show the value should appear in future)
This works. However, it isnt as elegant as I would like it, and if I indeed end up with more ways to calculate this for other people, it will be a lot of nested ifs.
I was therefore considering something like this:
=INDIRECT("[#["INDEX(mapTab_out;match(selected_Calc;mapTab_in;0))&]]")
But this gives a #ref, and tbh i didn't really expect it to work.
The idea is though: .
Have a range mapTab_in. This has the different selections for the dropdown box.
Have the adjecent range mapTab_out. This has the name of the column (X,Y...) that contains the desired calculation)
Have in column Z a formula for selecting which column's (X,Y...) value is to be displayed in Z
The google-stuff I have found so far all seem interested in using the indirect function from outside the table, and usually want to sum an entire column. I have used this in the past. The "ThisRow" things like using # dont seem to work with indirect though. Any ideas, or have I simply made some beginner-error in my formula?
Assuming it's in the same table, you can take advantage of implicit intersection and simply use:
=INDEX(Tablename,,MATCH(selected_Calc,Tablename[#Headers],0))
where selected_Calc is the name of the column you want back. (You could make that the result of a further INDEX/MATCH if you want to use a lookup table for some reason.)
i have a little problem with final formulas in one of my column. How to start. maybe i will explain what i have a then what i want.
i have an excel worksheet with 3 sheets. i want to record goods and what are these goods made of. first is sheet called Goods where is possible to put number of goods i want to make. In this case i want to make 1x sandwich1 and at the same time 3x sandwich2. i dont want make sandwich3 this time.
Second sheet is Matrix sheet where I record every good and what it is made of. This sheet is basic sheet and all other sheets take list of goods (resp. ingredients) from this sheet. Simply when i want to make sandwich1 i look at matrix and know that i need 1x1pc of egg + 1x5g of cheese. And for 3x sandwiche2 i need 3x10g of sausages.
Final sheet is called Ingredients. It is a list of used ingredients from Matrix sheet (exactly same order) to make these sandwiches. I want to fill formulas into column B which would go through one ingredient ofter ingredient and count needed amount of it. So it would look into matrix in the same row and where there is some number it would multiply with number of items from Goods sheet. The list of goods is also in the same order as in the matrix sheet.
I hope you understand now what i want and will try to help me. I think there will be SUMPRODUCT, SUMIF and maybe INDERECT functions but i am not that skilled in excel
thanks for any suggestions
You can use MMULT function here - it's an "array formula" which you need to enter in a range. You can do that like this:
In Ingredients worksheet enter this formula in B2
=MMULT(Matrix!C2:E4+0;Goods!B2:B4+0)
[I'm assuming you have a European version of Excel where ; is used to separate arguments]
Now select the whole range B2:B4, press F2 key to select formula and hold down CTRL and SHIFT keys and press ENTER. This "array enters" the formula in the range and you should now see curly braces like { and } around the formula and also the correct results.
You cannot change part of that array now, only the whole thing
Note that I'm assuming that the contents of Goods!A2:A4 will be the same as Matrix!C1:E1 and in the same order. You can extend the ranges to be as large as you like as long as that principle still holds
I suspect that this is an issue of "when all you have is a hammer, every problem is a nail". For reasons known only to you you are using a spreadsheet to solve a problem that databases were made to do. Any solution to this problem in a spreadsheet will be entirely dependent on the integrity of your data - add another column or get things out of order and it will fail.
That said, what you have in your link is effectively a pivot table and what you need is the unpivoted version of this - the instructions for getting this are here.
When you have that, you can use the various database functions in excel to get your answer.