Home > Net >  how to find the minimum product of two rows
how to find the minimum product of two rows

Time:10-07

I want to find the minimum of the products of each number with the number next to it

enter image description here

How do I find the minimum of all the products of each number in each row? For example here, the minimum would be 2 because 2x1 = 2 is less than 6x1 = 6 and so on. I could do this by making a separate column of all the multiples and find the minimum of that, but I don't want to unnecessarily make another column.

CodePudding user response:

If I understood your question correctly you want to find the minimum value of the product of Column A and B.

Try:

=ARRAYFORMULA(MIN(FILTER(A2:A12,A2:A12>0)*FILTER(B2:B12,B2:B12>0)))

Result: enter image description here

Explanation:

To explain simply you just need to use multiply the columns and use the MIN() function with ArrayFormula() like this =ARRAYFORMULA(MIN(A2:A12*B2:B12)), but this will return 0 if there are blank rows in the range since it is the minimum value. So you have to use FILTER() to both columns to exclude the blank rows and 0 values first before you multiply them.

CodePudding user response:

This would be one approach

=query(query(C1:D,"select C*D where C is not null and D is not null ",1),"select min(Col1)")

Can't see a way of doing it in a single query.

  • Related