It doesn't appear that there's a straightforward sigma summation function. How would one calculate the following?
Σ(n=1 to x) of 5+floor(x/10)
try:
=INDEX(SUM((SEQUENCE(1, DAYS(E1+1, E4), E4)*IF(F2="", 1, F2))^IF(H2="", 1, H2)))
Place the x-value in cell A1 and in another cell:
=5*A1+SUMPRODUCT(FLOOR(ROW(A1:INDEX(A:A, A1))/10,1))
This is for Excel. For Google sheets:
much the same.
Related
Need a formula that outputs the result below shown in the screenshot below:
I tried a combination of QUOTIENT() and MOD() functions.
You may try something in the style of:
={sequence(QUOTIENT(A2,C2),1,C2,0);mod(A2,C2)}
I'm currently upgrading my sheets for an MTB program.
I'm changing all my formulas to arrayformula so as to avoid anyone being left out when I forgot to drag the formula.
All that's left is the formula in cell P3. The formula is to sum the best 3 times for both categories of M and E.
Here's the link to the spreadsheet.
Any help is highly appreciated.
I want to sum the best 3 times for both categories of M and E.
Use MAP, like this:
={"BEST";ARRAYFORMULA(IF(E3:INDEX(E:E,MAX(ROW(E:E)*(E:E<>"")))=E2:INDEX(E:E,MAX(ROW(E:E)*(E:E<>""))-1),,MAP(E3:E,LAMBDA(team,IF(COUNT(FILTER(K:K,E:E=team,D:D="M"))<3,"DNQ",IF(COUNT(FILTER(K:K,E:E=team,D:D="E"))<3,"DNQ",IF(COUNT(FILTER(K:K,E:E=team))<6,"DNQ",SMALL(FILTER(K:K,E:E=team,D:D="M"),3)+SMALL(FILTER(K:K,E:E=team,D:D="M"),2)+MIN(FILTER(K:K,E:E=team,D:D="M"))+SMALL(FILTER(K:K,E:E=team,D:D="E"),3)+SMALL(FILTER(K:K,E:E=team,D:D="E"),2)+MIN(FILTER(K:K,E:E=team,D:D="E")))))))))}
I entered this formula in cell Q2.
=((E2*G3)+(E3*G4)+(E4*G5)+(E5*G6)+(E6*G7)+(E7*G8)+(E8*G9)+(E9*G10)+(E10*G11)+(E11*G12))/(E2+E3+E4+E5+E6+E7+E8+E9+E10+E11+E12)
Very obvious what this is doing. It's multiplying one cell in column E by cell in G, one row below. Then, dividing this by the sum of column E down to the row that you are up to. Is there a better way to format the first part so it can be dragged down?
Cheers :)
Use SUMPRODUCT for the numerator and SUM for the denominator? – BigBen 9 mins ago
Sorry if this is confusing. As you can see in the snapshot; in cell S8 I am trying to do a calculation with the numbers in the Order Amounts column in J28:J42 assuming the "allergens" in column I28:I42 match the allergens in column Q8:Q19. I was trying =if(J28:J42==Q8,) to start, then I was lost because I don't know how to reference the cell to the right of J28 if J28 matches Q8 to use that number for a calculation.
In cell S8 try this formula:
=ARRAYFORMULA(VLOOKUP(Q8:Q23, I28:J43, 2, FALSE))
Sample Data:
Output:
Reference:
VLOOKUP
ARRAYFORMULA
I need to sum a range of cells in each row but the cells have text that has to be ignored. For example, a cell may be 2= Moderate and I need the "2" for the sum.
If I use this formula, for one row, I get the correct result:
=SUM(SPLIT(REGEXREPLACE(CONCATENATE(F2:AB2), "[^\d]+", "|"), "|"))
Now I want to use ArrayFormula to repeat this formula for every row. With everything I've tried, I get the result of the first row repeated for every row. Example: if the result of row 2 is 14, then every row will show 14.
Here is the simplest formula I have tried:
=ArrayFormula(IF(ISBLANK(F2:F),"",
SUM(SPLIT(REGEXREPLACE(CONCATENATE(F2:AB2), "[^\d]+", "|"), "|"))
))
For the innermost range that is not getting changed to represent the current row, I have tried using indirect with relative references CONCATENATE(INDIRECT("R[0]C6:R[0]C28")) with the same result.
Is there a way to get ArrayFormula to work here?
Edit:
Adding link to demo version of sheet: https://docs.google.com/spreadsheets/d/17OYq3tjP1A1H8SPYAoAAlxOlrsFV2R5CQT3MNc7ZkMo/edit?usp=sharing
use:
=ARRAYFORMULA(MMULT(IFERROR(REGEXEXTRACT(
INDIRECT("F2:AB"&MAX((ROW(A2:A)*(A2:A<>"")))), "^\d+")*1, 0),
TRANSPOSE(COLUMN(F:AB))^0))
It is always difficult to write formulas without seeing your sheet, data or layout. But based solely on what you've provided, you can try this:
=ArrayFormula(IF(F2:F="",, MMULT(IF(ISNUMBER(F2:AB), F2:AB, 0), SEQUENCE(COLUMNS(F1:AB1), 1, 1, 0))))
MMULT performs matrix multiplication, which is difficult to explain but which essentially multiplies every element of one matrix by every element of another and adds the results by row.
Each element of each matrix must be numeric. So the formula creates the first matrix with an IF statement that replaces anything in the requested range that is a number with itself and anything that is not a number (i.e., text or blanks) with a 0. The SEQUENCE forms the necessary second matrix by creating a vertical "stack" of 1's that is the same width as the first matrix. And since anything multiplied by 1 is the original number, we get the correct result.
ADDENDUM:
After reading the additional comment by the OP and seeing a sample sheet, this is the MMULT setup needed:
=ArrayFormula(MMULT(VALUE(REGEXEXTRACT(FILTER(F2:AB, F2:F<>""), "\d+")), SEQUENCE(COLUMNS(F1:AB1), 1, 1, 0)))