Sheets formula to display all quotients and remainders of X divided by Y - google-sheets

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)}

Related

Having issues with Conditional formatting in Google Sheets

I am working on building a weight loss calculator. I am having problems using conditional formatting in my spread sheet. I am trying to have it green if less than c2, and red if greater than c2 . c2 is performed via a v look up function. I have also tried custom function to no avail. Ideally I would like to break this down as a percentage of c2 and have yellow as well but 1 step at a time. I have tried converting to a value and an int and still it's not working correctly.
Thank you in advance!
Please try the following
Select Custom formula is
Put =F15<C$2
Repeat once more with =F15>C$2
To avoid formatting empty cells use =AND(G14<F$3,G14<>"")
To get the Desired result you should use 2 conditional formatting rules with 2 different formulas, for the same range F11:F
Formula 1 to Highlight the range F11:F the "Calories" column with Green
=ArrayFormula(IF(F11:F="",,F11:F<$C$2))
Formula 2 to Highlight the range F11:F the "Calories" column with Red
=ArrayFormula(IF(F11:F="",,F11:F>$C$2))
Since you didn't provide the sheet i did recreate it from scratch.
Explanation
IF Range F11:F is Empty "" Do nothing ,, if isn't Empty check if F11:F < $C$2 in case of green formula 1 and check F11:F > $C$2 in case of red formula 2 if TRUE Highlight green / red if FALSE do nothing.
ArrayFormula allow the usage of non-array functions with arrays and the ability to show values returned by an array formula over many rows and/or columns.

Google sheets ArrayFormula - complex row equation repeats first result in every cell in column

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)))

Subtract a value before sumifs

I want to subtract a certain value before adding it together with sumifs. Made a simple example of what I want to do: see picture
You can try following formula:
=SUMIF($A$2:$A$7,D2,$B$2:$B$7)-COUNTIF($A$2:$A$7,D2)*E2

Transpose column of values skipping blank cells in Google Sheets

https://i.stack.imgur.com/f2Ztx.png
I need help, for example, I have a condition of thousands of data like in red border and want to form it like in result border
What kind of transpose formula do I have to use?
try to figure it out with this formula
=ARRAYFORMULA(QUERY(A3:A&",",,55000))
but still don't find a suitable result
try:
=ARRAYFORMULA(SPLIT(QUERY(A3:A,,99^99), " "))
or:
=TRANSPOSE(FILTER(A3:A, A3:A<>""))

Use ARRAYFORMULA with horizontal COUNTIF

I am using COUNTIF to count the number of occurrences of a value in a horizontal range, which is working fine:
Now I would like to use ARRAYFORMULA to automatically apply that logic to an entire column. My problem is that ARRAYFORMULA doesn't seem to work well with COUNTIF as my range spans both horizontally and vertically. I tried several things:
=ARRAYFORMULA(IF(COUNTIF(B2:D,"Passed")=3,"Passed","Failed")) : the formula doesn't even replicate across the column
=ARRAYFORMULA(IF(ISBLANK(B2:B),"",IF(COUNTIF(B2:D,"Passed")=3,"Passed","Failed"))) : using the extra IF(ISBLANK(B2:B) trick solves the above issue, but the results are wrong
How can I apply ARRAYFORMULA to a formula containing a horizontal COUNTIF?
Here is a link to the spreadsheet if you want to play around
An alternative:
=if(arrayformula(len(B2:B)*(B2:B="P")*(C2:C="P")*(D2:D="P")),"Passed","Failed")

Resources