With this table named jobSearches:
I am able to calculate the Average of the first row using following formula:
=AVERAGE(INDEX(jobsearches,1,))
Note that INDEX(jobsearches,1,) returns an array of values:
Question:
Is it possible to calculate the AVERAGE for just the first n values of the resolved array, and not for the whole row?
You can do something like this:
=AVERAGE(INDEX(jobsearches,1,2):INDEX(jobsearches,1,11))
Which will return the average of the first 10 numbers on the first row.
That's exactly OFFSET(reference,rows,cols,height,width) function is for:
=AVERAGE(OFFSET(jobsearches,0,1,1,10))
Related
I've got a massive parts spreadsheet that I'm trying to simplify. Various parts could be included in number of locations, which I would like to add up to a single list. The attached file is just an example using reindeer.
This is doable with using a bunch of SUMIF statements added together, but not practical due to the range of columns I need to include. There's gotta be a better way!?
=SUMPRODUCT(--($D$4:$J$11=$A4),$E$4:$K$11))
SUMPRODUCT can do that. Make sure the second range shifts one column, but has equal count of columns (and rows).
($D$4:$J$11=$A4) results in an array of TRUE's or FALSE's for the value in range $D$4:$J$11 being equal to the value in $A4 (no $ prior to it's row number will increase the row # referenced when dragged down).
Adding -- in front of the array converts the TRUE's and FALSE's to 1's and 0's respectively.
Multiplying that with the range to the right of it will result in 1* the value in $E$4:$K$11 for all TRUE's, which results in it's value, or 0* the value in $E$4:$K$11 for all FALSE's, which results in 0.
Summing the array of values results in the sum of all values where the condition is met in the column left from it.
SUMPRODUCT combines the multiplication of the array and summing the array results to 1 total sum.
You can use simply the SUM:
=SUM((D$4:$D$11=A4)*$E$4:$E$11,($F$4:$F$11=A4)*$G$4:$G$11, etc.)
where in etc you can put any range you want. If you don't use 2021/365 version, you must confirm the formula with CTRL+SHIFT+ENTER.
I would like to return the sum of all values that are directly below a look up value "Pre173RB" in a single column.
First I used index and match but this is limited to only finding the first value "8".
=INDEX(B:B,MATCH(E1,B:B,0)+1,1)
I then attempted to incorporate the above formula into the repeating sequence below. The formula returned the first value in the column "30". The desired return is "18".
=INDEX(B:B, SMALL(IF(ISNUMBER(MATCH(E$1,B:B,0)+1), MATCH(ROW(B:B), ROW(B:B)), ""),ROWS(A$1:A1)))
I've attempted to use sumif in the above formula as well but errors return.
Any assistance is appreciated. I am probably complicating the formula.
=SUMIFS(B2:B26,B1:B25,E1)
Note that the sum range is offset one row versus the condition range.
I have a table which I have copied from the internet and pasted in Excel. The data pasted is however not clean. I want to add the 1st, 4th, 7th, 10th... row from the column, while skipping 2,3,5,6,8,9...th row. And I'd like that solution to be in one cell, that is without adding a helper column.
Here is a snapshot of my demo table. Hope this gives you an idea of what I am trying achieve.
I've searched the internet found this question on SO. But I just can't modify the formula to get around my solution. Any help is greatly appreciated.
Seeing you have a header in your column.
Enter the following formula in your desired cell where you want the sum value
=SUMPRODUCT((A2:A13),(--(MOD(ROW(A2:A13),3)=2)))
Explanation:
MOD(ROW(A2:A13),3)=2 Checks for rows where row_number %% 3 = 2 and returns an array of boolean(TRUE or FALSE for each match)
Output : =SUMPRODUCT((A2:A13),(--({TRUE;FALSE;FALSE;TRUE;FALSE;FALSE;TRUE;FALSE;FALSE;TRUE;FALSE;FALSE})))
The double negative converts the boolean values to numeric 1(TRUE) or 0(FALSE).
Output: =SUMPRODUCT((A2:A13),({1;0;0;1;0;0;1;0;0;1;0;0}))
SUMPRODUCT multiplies the above array with the data array of A2:A16 and adds the product result.
How about using sumproduct? This function is greatly versatile and should do the trick. The idea is that the double negative sign casts the boolean to a one or zero so your false elements (aka any n where n%3 <> 1) get multiplied by zero so they are, in effect, excluded from your sum.
=SUMPRODUCT(--(MOD(ROW(A1:A16), 3)=1), A1:A16)
I have a pivot table with format as follows:
I find the highest export quantity in all countries by the formula max(B2:D4) which comes out as 83.
Now I want to find the company name corresponding to this max value i.e. CompanyA in this case.
The actual pivot table has 241 rows and over 40 columns. But the layout is as described.
On Approach would be following formula:
=INDEX($A$1:$A$4,MAX(IF(B2:D4=MAX(B2:D4),ROW(B2:D4)-ROW(A1)+1)))
Entered as a matrix formula with SHift+Ctrl+Enter
This should work for you:
=INDEX(A2:A4,MATCH(MAX(B2:D4),D2:D4,0))
Hope it's what you are looking for!
It would be nice to use a VLOOKUP but this can only find columns to the right of the match, so to go to the left of a match try this solution, which uses the MATCH() and INDEX() functions:
http://www.excel-easy.com/examples/left-lookup.html
Using your example image create 3 new columns (and then if you want combine them all into 1 by aggregating the formulas)
The formula for colum E is just your MAX function
For F it is this: =MATCH(E2,B2:D2,0). The MATCH() function looks for the value contained in cell E2 (which is the max of B2:D2) in the array B2:D2 which is row A of your company values. The trailing ,0 in the function parameters tells the function to look for the first exact match. It thus returns the column where the max value occurred. You can then use the column to look up the names of the companies:
For G it is =INDEX($B$1:$D$1,1,F2)
is it possible to use something like this in vlookup() ?
=vlookup(or(1,2,3,4), a1:c10, 2)
I want to find the first instance in column A that contains the numbers 1-4
You can't use VLOOKUP for this, but you can do it with the help of MATCH.
Try this (using array formula -> ctrl+shift+enter):
{=INDEX(B1:B10,MIN(IFERROR(MATCH({1;2;3;4},A1:A10,0), FALSE)))}
The idea is to match against 1-4 to get the index, convert errors to non-errors (FALSE), then get the minimum row number. Then that row number is used as an index to the values column.