#### mathgirl09

##### New Member

- Joined
- Jun 4, 2015

- Messages
- 10

A1 | 50 |

A2 | 48 |

A3 | 45 |

A4 | 42 |

A5 | 40 |

<tbody>

</tbody>

I want to select the cells from A1 to A5 containing the values as noted (A1=50, ..., A5=40) and I would like to select 2 cells everytime in that range so: selecting A1 and A2 and divide the smallest value by the largest : A2/A1 (= 48/50); then select A2 and A3, and divide A3 by A2 (=45/48) and so on.

I tried:

Code:

```
Function ratio(ByVal nb1 As Single, ByVal nb2 As Single) As Single
If nb2 > nb1 Then
ratio = nb1 / nb2
Else
Choose nb2 > nb1
End If
End Function
```