Sum value in google sheet with countif or any function - google-sheets

Sorry for my bad english. I am trying to sum value from selected column using countif. this is my sheet. and how can I get total quantity of milk chocolate. The result must be 310 (125 + 145 + 40). Please help me out

You can use SUMIF which returns a conditional sum across a range.
Syntax:
SUMIF(range, criterion, [sum_range])
Sample:
=SUMIF(A1:A6,"Milk Chocolate",B1:B6)

try like this:
=SUM(FILTER(E6:E; D6:D="Milk Chocolate"))

Related

Advice on how to include a function as condition in sumif

I am trying to sum the values in a range only corresponding to the row of current month.
I am using the formula
=sumif(A6:A17 ,"=TEXT(TODAY(),'mmmm')", E6:M17)
A6 to A17 has the 12 months, so I want the sum of row 7 from the range E6:M17
But I am getting 0 as result. Please help.
The function I used as the second argument is no equating to the manual months name in A6:a17.
Here's one approach:
=SUM(FILTER(E6:M17,A6:A17=TEXT(TODAY(),"MMMM")))

Google Sheets: Find minimum sum in an ordered array

My goal is to find the smallest sum of 1 entry per column in this array.
i.e. Though column 9 has the lowest value for all rows, only one value can be used, and same for all the other columns, and I want to know what combination will produce the smallest sum.
Is there any way of doing this in Google Sheets?
Thank you!
Use this formula
=INDEX(QUERY({A3:I},"Select "&
TEXTJOIN(", ",1,ARRAYFORMULA("min(Col"&COLUMN(A3:I)&")"))),2)

Repeating a value on the basis of count provided in another cell - Google Sheets

I'm trying to write a formula where I can generate a number n number of times where n can be the input provided by the user.
=ARRAYFORMULA(TRIM(TRANSPOSE(SPLIT(QUERY(
REPT($D2&",", $E2), ), ","))))
Ideal output
Here D2 is the value to be repeated and E2 is the number of times.
So instead of manually using this formula after each last repeated value to generate the next set of repeated values, I want to print the values in one go. I'll be really grateful, if anyone could please provide a way around to do the same. Thanks in advance.
Try this
=ARRAY_CONSTRAIN(arrayformula(query(flatten(split(rept("|"&D2:D,E2:E),"|")),"select * where Col1 is not null")),SUM(E2:E),1)
explanation
the core of the formula is
=arrayformula(iferror(split(rept("|"&D2:D,E2:E),"|")))
then, apply flatten with a limitation of rows (ARRAY_CONSTRAIN) equal to the sum of column E, and query only the rows that are not null
Try the below formula:
=ARRAYFORMULA(TRIM(TRANSPOSE(SPLIT(QUERY(
REPT(D2:D&",", E2:E), ,999^99), ","))))

How to create an ARRAYFORMULA that SUM multiple columns that are not next to each other

Kind people smarter than myself:
I want to convert this formula in Google Sheets:
=SUM(L3:O3,R3:U3)
into an array formula for rows 3 - 24. Any help or suggestions appreciated, thanks!
An array formula is created by entering the formula and then using
ctrl + shift + enter
Does this formula work for you:
{=SUM(L3:O24,R3:U24)}
You'll notice than an array formula will automatically add the {} to the front and back of the formula.
Use +
=ARRAYFORMULA(L3:O3+R3:U3)
or
=ARRAYFORMULA(L3:O24+R3:U24)

Google Sheets - dynamic lookup sum

I have a vertical list of points and several horizontal sheets of data. I want to get a sum of the data from each of those sheets, multiply them by value of their header key, and get a sum of each row of data.
For row 2 I want the total to be 1,011 (3 x 123 = 369, 2 x 321 = 642, 369 + 642 == 1,011) where it looks up the header of aaa and bbb, gets their point value, and multiplies it by their row value. I'm sure I can hack it and get the result but I'd like to get an efficient way to do it.
This seems to be a straightforward SUMPRODUCT formula.
=sumproduct((A3:A4=D1:E1)*(B3:B4)*(D2:E2))
Sample Google-Sheet
=SUMPRODUCT(B:B*iferror(hlookup(A:A,D1:E2,2,false),0))
or
=SUMPRODUCT(B:B*iferror(hlookup(A:A,1:2,2,false),0))

Resources