# Find second min value in array or Ignore Zero while finding Min

Hi,

I have a requirement i need to find the minimum value from selected 4 cells i tried with array to find the minimum i can able to find the min value but issue is if 0 is present min value showing as 0 but it when there is a zero present it should ignore that and it should find min value among other 3 values.

Array = {va1,var2,var3,var4}

Array.min

if Var1 =2
Var2 = 3
Var3 = 0
Var4 = 1

Expected output = array.min should be 1

Regards,
Lawrance A

Hi @Lawrance_A
p2.xaml (9.9 KB)
PFA solution.

Regards
Rishi

1 Like

@Lawrance_A

Try this

``````intminvalue = (From p In arr
Where not p=0
Order by p
Select p).ToArray(0)
``````

Regards,
Mahesh

Thank you.

Thank you.

Hi Rishi,

i have a issue while array is {0,0,0,6} my requirement is it should take 6 but as per your code its taking second digit “0” , Can you help to overcome this ?

See this

Main.xaml (5.5 KB)

Thanks,
Prankur

3 Likes

Hi @Lawrance_A
PFA p2.xaml (11.2 KB)

Smart Solution

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.