# How to get the relative cell number within a range?

• For example, the range C4:H9, a 6x6 range, if I were to have cell C5 selected and wanted to know that it was the 7th cell going from left to right, up to down, how could I easily determine that?

• Hello,

What is your definition of " easily " ...???

To count the total number of cells in your range : =ROWS(C4:H9)*COLUMNS(C4:H9)

But, for the relative cell number, you will need VBA ... which might go against your definition of " easily " ...

If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner

• Hello again,

Agree with pike

Although it seems to me ... UDF would be more in line with initial request ...

Code
1. Function relative(rng As Range, c As Range)
2. ' UDF to get Relative Cell Number in Range
3. Dim r As Range, n As Long
4. For Each r In rng
5. n = n + 1
6. If c.Address = r.Address Then relative = n
7. Next r
8. End Function

Hope this will help

If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner

• Very true,, i'm a bit rusty

Let me doubt it ... !!!

The rabbit is well known for his ability to run very fast ...

If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner

• Thanks, was looking for a VBA solution. I wasnt sure if there was already a built in way to determine this. Thanks.

• Thanks for your Thanks

If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner