How to get the relative cell number within a range?

  • 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 "Smiley" 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
    Function relative(rng As Range, c As Range)
    ' UDF to get Relative Cell Number in Range
    Dim r As Range, n As Long
        For Each r In rng
            n = n + 1
            If c.Address = r.Address Then relative = n
        Next r
    End Function

    Hope this will help

    :)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" 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 "Smiley" icon, below, in the bottom right corner :)

  • Thanks for your Thanks :)

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

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!