Excel 2010 Calculating Production line quantities without long calculations - excel

Program: Excel 2010
Requirements: Prefer no VBA (Macro free book)
I am creating a spreadsheet to calculate items required for components (parts). I have a list of the product, and under the number of specific parts. I have a calculation which tells me what the total parts are needed, but, is there a better way?
=($C$32*C34)+($D$32*D34)+($E$32*E34)+($F$32*F34)+($G$32*G34)+($H$32*H34)+($I$32*I34)+($J$32*J34)+($K$32*K34)
| A | B | C | D | E | F |
| Making: | | 2 | 2 | 2 | |
|---------------|-------|------------|-------------|-----------------|---------|
| Item -> | Total | Small raft | Rowing boat | Sm sailing boat | Corbita |
| | | | | | |
| Planks | 20 | 4 | 6 | | |
| Logs | 8 | 4 | | | |
| Nails - Large | 16 | 8 | | | |
| Oars | | | | | |
In the above, you can see that ($C$32*C34) = 8 & ($D$32*D34) = 12 => 12+8 = 20 (B34) (Planks Total)
Is there an easier way of doing this, or will my equation just keep getting bigger?
Thanks in advance.

As chris neilsen mentioned in his comment, you can use the SUMPRODUCT function in Excel. The formula in your cell B34 (total planks) should look like this:
=SUMPRODUCT(C32:K32,C34:K34)
This has the effect of multiplying the corresponding components in the given ranges (C32 * C34, D32 * D34, etc.) and then returning the sum of those products/multiplications.
As you add more columns, you can expand K to the last column in the range that you want to add up in both ranges.

Related

Sum named range consists of several columns and rows

I have a list that is divided into countries vertical and years horizontal like below.
I need to sum all numbers for 2020 respective for each country. Each country have several lines divided into different months.
2020 2021
J | F | M | A | M |...| J | F | M | A | M |...
-------------------------------------------------------
Denmark | | | 15| | 12| | | | | | |
Norway | | | | | | | | | 10| | |
Germany | | | | 11| | | | | | | |
Each year have been called a named range, e.g. Year2020.
I have tried using =SUMPRODUCT(SUMIFS(Year2020;CountryRNG;Country)), MATCH/INDEX and also =SUM(INDEX(Year2020;0;MATCH(1E+99;INDEX(Year2020;1;0)))).
How can I do this with one formula?
You can use SUMPRODUCT:
=SUMPRODUCT((Country=CountryRNG)*Year2020)
With a few notes:
CountryRNG and Year2020 have the same number of rows
Year2020 is only the data. No Text or Errors in the data field
Both ranges are limited to the data and does not include full column references. This is to limit the number of iterations that will slow down the calcs. It will work with extra rows, but the more unneeded iteration will cause extra work.

Return unique column headers matching criteria

Consider the following data below:
| 1st | 2nd | A | B | C | D | E | F | G | H |
|-----|-----|---|---|---|---|---|---|---|---|
| y | x | | | 1 | | | | | |
| y | x | | | 1 | | | | | |
| y | x | | | | 1 | | | | |
| | x | 1 | | | | | | | |
| y | | 1 | 1 | 1 | | | | | |
| y | x | | | | | | 1 | | |
| y | | | | | | | | 1 | |
| | x | | | | | 1 | | | |
| | x | | | | | | | | 1 |
| y | x | | | | | | | | 1 |
What I wish to do is to return all column headers (from A to H) that meets the following condition: it should have a value of 1 that is both aligned with a y and x value from the first two columns.
I already have a working array formula to do this, which is as follows:
{=INDEX($C$1:$J$1,SMALL(IF(($A$2:$A$11="y")*($B$2:$B$11="x")*($C$2:$J$11=1),COLUMN($C$1:$J$1)-COLUMN($B$1)),ROW(1:1)))}
However, while I drag this down, it returns two C values and one for D, F and H.
This is since there are two 1's under header C that meets the said condition. What I want is to return unique values, so C should only be returned once. I tried to make use of MATCH and additional COUNTIF instead of the SMALL function, but it is returning an error, and the 'Evaluate formula' feature of Excel isn't helping. Below if the erroneous formula I experimented with:
{=INDEX($C$1:$J$1,MATCH(0,IF(($A$2:$A$11="y")*($B$2:$B$11="x")*($C$2:$J$11=1),COUNTIF($N$1:N1,COLUMN($C$1:$J$1)-COLUMN($B$1))),0))}
A workaround I am currently doing is to make my first formula a "helper column" and then create another formula based from the first formula's result to return only the unique values. However, the double array formula is heavily affecting the efficiency of Excel's calculation due to the huge volume of data I'm dealing with.
Any help/suggestions will do please (no VBA please, since I believe it's not needed here). Thanks!
Insert a helper row. I did it just under your header row before your data. In this row you check to see if there is a 1 that lines up with an x and a y. I assumed this to be non blank, but if its specific values change the formula from <>"" to ="y" or =134 as the case may be. Place the following formula under your first column header you are interested in and copy right.
=--(0<SUMPRODUCT(($B$3:$B$12<>"")*($C$3:$C$12<>"")*(D3:D12=1)))
Then where you want to generate your list in a column without space and sorted in the order the appear in from left to right in the headings, use the following formula and copy down as required:
=IFERROR(INDEX($1:$1,AGGREGATE(15,6,COLUMN($D$2:$K$2)/$D$2:$K$2,ROW(A1))),"")
The above formula put in a blank value when no column heading applies are you have copied the formula down beyond the number of applicable columns.
The above formulas are based on the proof of concept image below. Adjust ranges to suit your needs.
Have you tried without the use of an array formula? I don't know how large the data actually is. But, this might be what you are looking for:
=IF(COUNTIFS($A:$A,"y",$B:$B,"x",C:C,1)>0,C1,"")
Assuming column A is "1st" and "H" is your last column at colunm J. Try pasting the formula at "K1" and drag it to your right until "S1".

Excel In cell formula Number of surveys administered

Good Afternoon,
I have an excel sheet that records encounters with community residents by name and date. During each encounter a brief survey is also administered. I want to track changes to these survey questions by name over time. Is there any way to do this with in cell formulas? Here's an example of the table I have in mind:
| Name | Date | Q1 | Q2 | Stress | Survey Number |
| | | | | | (calculated) |
|--------------|------------------|----|----|--------|---------------|
| Steve Rogers | 5/1/2018 | y | y | 5 | 1 |
| Steve Rogers | 5/2/2018 | y | y | 6 | 2 |
| Tony Stark | 5/1/2018 | n | n | 10 | 1 |
| Nick Fury | 5/1/2018 | n | y | 8 | 1 |
| Nick Fury | 5/2/2018 | y | y | 5 | 2 |
| Tony Stark | 5/2/2018 | y | n | 8 | 2 |
| Tony Stark | 5/3/2018 | n | n | 4 | 3 |
I want to calculate the survey number by referencing the name and the date. I have no idea where to start, honestly. Is this even possible using an in-cell reference?
Use COUNTIFS()
=COUNTIFS(A:A,A2,B:B,"<=" & B2)
Put that in F2 and copy/drag down.

MIN IF for sub ranges

I had asked this question for MAX IF for sub ranges before. how to find the maximum value (col A) for different items into a range (col B in this case) written on the C col
| A | B | C |
| 10 | cat | |
| 15 | cat | |
| 5 | dog | |
| 4 | dog | |
| 11 | dog | |
| 6 | fish | |
| 10 | fish | |
ppl answered me =MAX(INDEX(("$B$1:$B$7=B1)*$A$1:$A$7,0)) which works fine, but when i tried to use it for the minimum values, I mean =MIN(INDEX(("$B$1:$B$7=B1)*$A$1:$A$7,0)) i got zero for the whole C col.
what could i do wrong?
I always use this for finding min and max with an array formula. Be sure to enter the below with a Shift + Ctrl + Enter.
{=MIN(IF($B$1:$B$7=B7,$A$1:$A$7,""))}

Transform values without VBA but with Index and Match

I'm trying to find a solution without macros in excel for following problem:
There is a table containing ratings of a student for different time periods.
So the rating of the student with ID=1 was 1 from January to April and 3 from Mai to June.
Two other students had a constant ranking (6 and 9) from January to June
| A | B | C |D |
---| ----|------------|------------|-------|
1 | ID | START | END |RANKING|
2 | 1 | 01.01.2014 | 30.04.2014 | 1 |
3 | 1 | 01.05.2014 | 30.06.2014 | 3 |
4 | 2 | 01.01.2014 | 30.06.2014 | 6 |
5 | 3 | 01.01.2014 | 30.06.2014 | 9 |
Next table contains IDs (y axis) and Months (x axis)
| F | G | H | I | J | K | L |
---| ----|--------|--------|--------|--------|--------|--------|
1 | ID | 201401 | 201402 | 201403 | 201404 | 201405 | 201406 |
2 | 1 | | | | | | |
3 | 2 | | | | | | |
4 | 3 | | | | | | |
And I wish to feel this second table like this:
| ID | 201401 | 201402 | 201403 | 201404 | 201405 | 201406 |
| ----|--------|--------|--------|--------|--------|--------|
| 1 | 1 | 1 | 1 | 1 | 3 | 3 |
| 2 | 6 | 6 | 6 | 6 | 6 | 6 |
| 3 | 9 | 9 | 9 | 9 | 9 | 9 |
I tried to use Index and Match, but without any good results because I haven't found a posibility to use IF (if (
Could anybody help?
You can get what you're looking for with SUMPRODUCT
Given the layout you provided, this formula should work when put in G2 and filled down and over
=SUMPRODUCT(--($A:$A=$F2),--($B:$B<=G$1),--($C:$C>G$1),$D:$D)
That looks in column A for an ID matching F2, then for every one it finds of those:
It checks the date in column B against the date in G1
It checks the date in column C against the date in G1
If all criteria match, it returns the value in Column D
This assumes you only have one entry for each period, otherwise it will sum them.
Also, you can use SUMIFS, it's a little less easy to read but I think it's slightly more efficient than SUMPRODUCT (I'm not positive, just anecdotal evidence from usage)
=SUMIFS($D:$D,$A:$A,"="&$F3,$B:$B,"<="&G$1,$C:$C,">"&G$1)
It does the exact same thing, just with different syntax.

Resources