We’d like to remind Forumites to please avoid political debate on the Forum.

This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.

📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!

Excel Help - Please

Hi folks,

I am putting together a small excel document and am very new to the whole formula thing

Initially I would like to know if it is possible to obtain a total (by number) of rows that has a hyperlink
?

I have a number of rows containing names (120 total). Some of these have a certain skill and i have highlighted that skill by attaching a hyperlink to their name/s

At the top i have a single cell that i would like to obtain a number value of how many have the skill denoted by a hyperlink

is this possible?
«1

Comments

  • droopsnoot
    droopsnoot Posts: 1,892 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    The easy way I'd do it is to have another column where each cell contains the following formula, or one very similar to it:

    =IF(ISNUMBER(SEARCH(".",D6)),1,0)

    where "D6" in this case is the cell that contains either nothing, or your hyperlink. You now have a cell alongside that will either contain "1" if the hyperlink field contains a "." (fair to assume any external link will do so), or 0 otherwise. You can then sum that column to get your count.

    Probably a much easier way of doing it, I only have Excel 2003 and not used it in depth. No doubt someone else will be along with more suggestions.
  • InsideInsurance
    InsideInsurance Posts: 22,460 Forumite
    10,000 Posts Combo Breaker
    Are they all hyperlinks to a common site or such? If they are then the easy way to do it is to treat it like text and do:

    =CountIf(C1:C10, "*domain.com*")

    To actually test for a true hyperlink rather than just a common piece of text is more tricky without using macros/ VBA
  • bod1467
    bod1467 Posts: 15,214 Forumite
    Alternatively, if they links are to different websites then (using the same idea) ...

    =COUNTIF(A2:A6,"://")

    This assume the hyperlink is visible and includes the http:// part. If the only information seen is the person name and that some names are clickable, then I don't know.
  • Use a custom function
    Function countLinks(r As Range)
    For Each c In r
    If c.Hyperlinks.Count = 1 Then countRng = countRng + 1
    Next c
    countLinks = countRng
    End Function

    Count the links using the formula
    =countLinks(A1 : A10)
  • mercman1969
    mercman1969 Posts: 871 Forumite
    Use a custom function
    Function countLinks(r As Range)
    For Each c In r
    If c.Hyperlinks.Count = 1 Then countRng = countRng + 1
    Next c
    countLinks = countRng
    End Function
    Count the links using the formula
    =countLinks(A1 : A10)

    How do you use a custome function?
  • mercman1969
    mercman1969 Posts: 871 Forumite
    Use a custom function
    Function countLinks(r As Range)
    For Each c In r
    If c.Hyperlinks.Count = 1 Then countRng = countRng + 1
    Next c
    countLinks = countRng
    End Function
    Count the links using the formula
    =countLinks(A1 : A10)


    Tom,

    Many thanks...I have sorted it (of sorts)

    I have used 2 cells merged together to make a single cell

    When i put in your formula i am getting the number that is correct but assuming a single cell for each item....

    How would i divide the number by 2 in order to obtain the correct number?
  • TrickyDicky101
    TrickyDicky101 Posts: 3,534 Forumite
    Part of the Furniture 1,000 Posts
    I would think you can shorten that to:

    Function CountLinks(r As Range)
    CountLinks = r.Hyperlinks.Count
    End Function

    which won't double count merge cells containing links.
  • mercman1969
    mercman1969 Posts: 871 Forumite
    I would think you can shorten that to:

    Function CountLinks(r As Range)
    CountLinks = r.Hyperlinks.Count
    End Function

    which won't double count merge cells containing links.

    TrickyDicky......

    Many thanks....worked a treat

    how little i know about excel.......
  • Heedtheadvice
    Heedtheadvice Posts: 2,800 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    edited 10 March 2014 at 1:42PM
    =countLinks(A1 : A10)/2 ?

    or in the vba "countLinks = countRng/2"

    but best to probably not have a merged cell for this sort of thing as it will be prone to errors if the cell merging gets changed.


    Ah! beaten by the post!!

    As with Excel it's very powerful and there are many ways to skin a cat!!!

    i.e. lots of other ways
  • mercman1969
    mercman1969 Posts: 871 Forumite
    My next question is..........

    Can i obtain a number from a Colour?

    My next field cell has 2 Colour options

    Yellow
    Green

    I would like to obtain a number field from the amount of Green cells with a columb......can this be done?
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 352.1K Banking & Borrowing
  • 253.5K Reduce Debt & Boost Income
  • 454.2K Spending & Discounts
  • 245.1K Work, Benefits & Business
  • 600.7K Mortgages, Homes & Bills
  • 177.4K Life & Family
  • 258.9K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16.2K Discuss & Feedback
  • 37.6K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.