Find minimum value in multiple column range with criteria - excel

How can I find the minimum value in columns B:C in the table below if the volume is <= 10.
The expected result is in yellow.
Regards,
Elio Fernandes

Either:
=AGGREGATE(15,6,C2:C9/(A2:B9<=10),1)
or, array formula**:
=MIN(IF(A2:B9<=10,C2:C9))
If there may be blank cells in B2:C9:
=AGGREGATE(15,6,1/(1/C2:C9)/(A2:B9<=10),1)
or:
=MIN(IF(A2:B9<=10,IF(ISNUMBER(C2:C9),C2:C9)))
Regards

You can use this formula to get the minimum value (Which according to me should be 20 in your data set)
=MIN(1/AGGREGATE(14,6,1/((A2:A9<=10)*B2:B9),1),1/AGGREGATE(14,6,1/((A2:A9<=10)*C2:C9),1))
for each additional column(say D) you will have to add the formula 1/AGGREGATE(14,6,1/((A2:A9<=10)*D2:D9),1) inside the MIN() formula.
Looking for a better way to do this.
EDIT:
Alternatively you could add a new row below your data. for each column you add the below formula to get the min for that column
=1/AGGREGATE(14,6,1/(($A$2:$A$9<=10)*B2:B9),1)
Now you can drag this formula to as many columns you want. Take the MIN() of this row to get the overall minimum.

Related

Find maximum values before a zero in excel

I'm trying to use the formula =MAX(FREQUENCY(IF(T2:AC2>1,ROW(T2:AC2)),IF(T2:AC21>=1,ROW(T2:AC2))))to find more than one maximum value before a zero from a range.
ROW has this values
1​ 2​ 0​ 1​ 2​ 3​ 4​ 5​ 6​ 0​
I want a formula/formulas that will return 2 and 6
Thank you
You can use this formula
=LET(list,
FILTERXML("<t><s>"&SUBSTITUTE(SUBSTITUTE(CONCAT(A1:A16),"d","l"),"l","</s><s>")&"</s></t>","//s"),
LEN(list)-LEN(SUBSTITUTE(list,"w","")))
Got this working:
=IFERROR(INDEX(R:R,AGGREGATE(15,6,ROW(R$3:R$100)/((R$3:R$1100=0)*(R$2:R99<>0)),ROWS(S$3:S3))-1),"")
Assuming the data is in column R, put the formula in column S. Link: https://www.mrexcel.com/board/threads/find-more-than-one-maximum-value-before-a-zero.1188659/post-5793250.

How to list out the location of duplicated maximum value in Excel?

I have the table to show the NC quantity and C quantity of item 1.1a - 1.4e in excel file.
I want to find out the maximum value of C, that i use below formula in H4:
=MAX(C4:C22)
that show the maximum value of C is 8, then i want to find the maximum value corresponding to which item, so i use below formula in H5:
=(INDEX($A$4:$A$22,MATCH(H4,$C$4:$C$22,0)))
It shows only one result which is 1.1a, how can i list out all the item which has the maximum value which i use for vlookup the information?
Please find the Capture.jpg for your reference.
Thank you very much for your help.
Use FILTER() with MAX() formula.
=FILTER(A2:A6,C2:C6=MAX(C2:C6))
Edit: To display result in single cell with comma separated use below formula.
=TEXTJOIN(", ",TRUE,FILTER(A2:A6,C2:C6=MAX(C2:C6)))

How do I Count cells in excel, starting with a cell that has a specified value?

The question is slightly confusing, so I will do my best to elaborate. I have a series of cells in a row with all of the cells in the row with a value of 0 and one cell having a value of 1. I want to use the COUNT function to count all of the cells to the right of the cell that contains the value of 1, including that cell. I would then use this number of counted cells in another equation. Does anyone have any suggestions on how to do this? I have tried using a lookup function inside of the count function, but it has not worked. This is my closest guess:
=COUNT(Lookup(1,A1:J1):J1)
This results in an error. Do I need to use VBA to make this work or should I be able to write an equation? I appreciate the help, or if there are any other strategies that I can use to attain the result I am looking for.
Edit: I am adding in some sample data and expected results. I am trying to count all of the cells to the right of the "1" including the cell containing the "1". So in this example, I would expect the formula to return "13" as there are 12 cells to the right of the "1"
You can use OFFSET() and MATCH():
That last "50" is a bit of a guess since I'm not sure how far to the right you want to count...
...and re-reading your question it's not clear if you only want to count values of 1 or if you also need to count other values as long as they're to the right of the first 1.
With data in A1 through J1, consider:
=10-MATCH(1,A1:J1,0)+1
In this case. 4 is the number of cells from G1 through J1, inclusive.
Assuming your range of 0 and 1 values is in row 2, starting from column B, use this formula in B3 and copy it across for as far as you need:
=IFERROR(COUNT($B2:B2)+1-MATCH(1,$B2:B2,0),0)
You could also use a formula of
=IF(A3>0,1+A3,IF(B2=1,1,0))
but that could cause issues if you have something in cell A3 itself.
You can use this formula:
=COUNTA(INDEX($A$1:$J$1,1,MATCH(1,$A$1:$J$1,0)):INDEX($A$1:$J$1,1,10))
The benefit to use this is it is not a volatile function, and it will also work for 1 appears in the last column.
You can use "COUNTIF" formula to count number of occurrences of specific number in a range of cells.
To count no of occurrences in a row.
=COUNTIF(1:1,1)
If it is in a column then
=COUNTIF(A:A,1)
Hope you are looking for a countif function.
COUNTIF(A1:A10, 1)
The above function counts the cell that has value 1 within the range A1:A10

Calculate the COUNTIFS criteria range dynamically

I have a excel formula as below,
COUNTIFS($A$8:$A$14,$A8,$B$8:$B$14,$B8)
Here I want the criteria range to be calculated with a simple logic.
Instead of $A$14 I want this value to be calculated A$8+4 i.e. $A$14
In other words, it should get the current row and add 4 to be the criteria range for COUNTIFS
How can this be done is excel within the COUNTIFS formula?
Cheers
You could use =OFFSET(Cell Reference, Rows, Columns) within your formula to achieve this, for example:
=COUNTIFS($A$8:OFFSET($A$8,6,0),$A8, etc...)
Lets assume that the size of your range to be returned is stored in the cell D1.
=COUNTIFS($A$8:INDEX(A:A,ROW($A$8)+D1),$A8,$B$8:INDEX(B:B,ROW($B$8)+D1),$B8)
If you want the range to be defined as a certain number of rows after the current row as stated in your question, then still assuming the number of rows to be added is in D1, you would use the following:
=COUNTIFS($A$8:INDEX(A:A,ROW()+D1),$A8,$B$8:INDEX(B:B,ROW()+D1),$B8)
Expanding on Oliver's answer. The full format of OFFSET allows you to specify a whole range, not just one cell. OFFSET(Reference, Row Offset, Col Offset, Height, Width) so you could do:
OFFSET(A8,0,0,4,1)
This specifies the range A8:A11. In the COUNTIF
=COUNTIF(OFFSET(A8,0,0,4,1),A8,...)
Locking cells with $ works the same way within OFFSET if needed.
Try this:
=COUNTIFS(INDIRECT("$A$8:$A$" & 8+6),$A8,INDIRECT("$B$8:$B$" & 8+6),$B8)

Excel SUM and IF combine help

I have two columns of numbers. Both are 1 to 5. I want to count all the cells where the left column value equals the right column value AND the left column value equals a certain value.
I tried this:
=SUM(IF(W2:W13=X2:X13 AND W2:W13=4,1,0))
I've tried pressing Ctrl+Shift+Enter and it adds {} around the formula but that didn't help either.
I think it's the W2:W13 = 4 part that doesn't work
=COUNTIFS(W2:W13,"=4", X2:X13, "=4")
You can use the sumif() function:
SumIf( range, criteria, sum_range )
it will apply the criteria for each row in the range.
Edit: to count the matches, you can use sum_range = 1 or use the Countif() function suggested by Ben in his answer
Have you considered a third column (C) with the formula IF(A1=B1,1,0) and then summing that third column?
I'm not much of an Excel Expert, but didn't they craeted the COUNTIF(range, criteria) function for this?
Add a third column eg Z2:Z13 with this formula: IF(AND(W2=X2; W2=4); 1; 0)
Then sum that one.
I don't have Excel 2007. So here's how you can do it in Excel 2003:
=COUNT(IF((W2:W14=4)*(X2:X14=4),Y2:Y14))
Since you are looking for a specific value and the column next to it to be the same value, you can just compare both columns to the same value.
The trick to get this to work is after entering the formula you need to hit F2 to go into edit mode and then hit CTRL-SHIFT-ENTER which makes this formula an array formula. This will put {} around the entire formula. Without making this an array formula this formula won't work.
I found this information in the Excel help document titled Count how often a value occurs

Resources