# Excel

Super Contributor

# Excel

Hello Everyone,

Here is a question :

1 >> Highest Multiple of 2 that is <= the minimum value of "B" column..??

2 >> Lowest Multiple of 3 that is <= the minimum value of "D" column..??

Here is a attached file..

I am using Microsoft Office 2019 Home and student version...

3 Replies

# Re: Excel

``````Sub large()

Dim i As Integer
Dim j As Integer

i = Application.WorksheetFunction.Min(Range(Cells(2, 5), Cells(11, 5)))

For j = i To i + 2

If j Mod 3 = 0 Then
Cells(16, 9) = j

Else

End If

Next j

End Sub``````
``````Sub small()

Dim i As Integer
Dim j As Integer

i = Application.WorksheetFunction.Min(Range(Cells(2, 3), Cells(11, 3)))

For j = i To i - 1 Step -1

If j Mod 2 = 0 Then
Cells(14, 9) = j

Else

End If

Next j

End Sub``````

Maybe with these lines of code. In the attached file you can click the buttons in cells K14 and K16 to start the macros.

# Re: Excel

Sir can we solve without VBA code?
Can we apply formula ?

# Re: Excel

``=IF(MOD(SMALL(C2:C11,1),2)=0,SMALL(C2:C11,1),SMALL(C2:C11,1)-1)``
``=IF(MOD(SMALL(E2:E11,1),3)=0,SMALL(E2:E11,1),IF(MOD(SMALL(E2:E11,1),3)=1,SMALL(E2:E11,1)+2,SMALL(E2:E11,1)+1))``

Maybe with these formulas.