Get values from a range based on certain conditions

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
1,226
Office Version
  1. 2010
Platform
  1. Windows
  2. Mobile
I want to get the value from contiguous columns B2:M2 corresponding to the MINIMUM non zero and non-blank value from C6:M6 else 0.

Also, I need the preceding cell’s value of the above corresponding cell from B2:M2 else 0

I need 2 formulas

Thanks in advance
1​
2​
3​
55​
234​
67
55
8​
9​
10​
30​
20​
10​
20​
44​
-13​
60​
-18
66​
0​
100​
300​
-29​
67​
Predceding
55​
Corresponding to minimum C6:M6
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Why do you show 67 and 55 as the results? The minimum non zero and non-blank value from C6:M6 is -29 isn't it?

Wouldn't it be this?

24 02 17.xlsm
BCDEFGHIJKLM
1
212355234675589103020
3
4
5
6102044-1360-18660100300-29
7
8
930Predceding
1020Corresponding to minimum C6:M6
Sheet4
Cell Formulas
RangeFormula
J9J9=INDEX(B2:M2,MATCH(MIN(C6:M6),C6:M6,0))
J10J10=INDEX(C2:M2,MATCH(MIN(C6:M6),C6:M6,0))
 
Upvote 0
Sorry, I forgot to eliminate blank/zero values as possibilities. You may want this instead.

24 02 17.xlsm
BCDEFGHIJKLM
1
212355234675589103020
3
4
5
61034460660100300
7
8
92Predceding
103Corresponding to minimum C6:M6
Sheet5
Cell Formulas
RangeFormula
J9J9=INDEX(B2:M2,MATCH(AGGREGATE(15,6,C6:M6/(C6:M6<>0),1),C6:M6,0))
J10J10=INDEX(C2:M2,MATCH(AGGREGATE(15,6,C6:M6/(C6:M6<>0),1),C6:M6,0))
 
Upvote 0
Why do you show 67 and 55 as the results? The minimum non zero and non-blank value from C6:M6 is -29 isn't it?
Typo Sir, it is 29 instead of -29.
Both formulas should also be checking C6:M6 for non zero and non blank to get the 2 answers
 
Upvote 0
Yes I needed this. Thanks Sir.
1 more: Also, I need the succeeding cell’s value of the above corresponding cell from B2:M2 else 0 (answer is 8 here)
 
Upvote 0
, I need the succeeding cell’s value of the above corresponding cell from B2:M2 else 0
Try
Excel Formula:
=IFERROR(INDEX(C2:M2,MATCH(AGGREGATE(15,6,C6:M6/(C6:M6<>0),1),C6:M6,0)+1),0)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top