+ Reply to Thread
Results 1 to 5 of 5

How can I count strings within strings

  1. #1
    Paul W
    Guest

    How can I count strings within strings

    I'm trying yo count the number of occurances of a string in a variable string
    e.g look for "VVN" in TDCS0/VVN/8375 or mycompany/VVN/8375 or even
    mycompany/TDCS0/VVN/8375. The text does not appear in the same location each
    time. so what i am looking for is countif(a1/a96="VVN anywhere in this
    string")

    Excel 2002

    Help !






  2. #2
    Forum Expert
    Join Date
    12-24-2004
    Location
    Sweden
    Posts
    1,256
    To find the number of times VVN occures in one cell:
    =(LEN(A2)-LEN(SUBSTITUTE(A2,"VVN","")))/LEN("VVN")

    To find the number of times VVN occures in a range:
    =SUMPRODUCT((LEN(A2:A4)-LEN(SUBSTITUTE(A2:A4,B1,"")))/LEN(B1))
    Range: A2:A4
    B1: "VVN"

    HTH
    Ola Sandström


    Picture: http://www.excelforum.com/attachment...tid=3493&stc=1
    Attached Images Attached Images

  3. #3
    Arvi Laanemets
    Guest

    Re: How can I count strings within strings

    Hi

    =COUNTIF(A1:A96,"*"&"VVN"&"*")

    --
    Arvi Laanemets
    ( My real mail address: arvil<at>tarkon.ee )


    "Paul W" <[email protected]> wrote in message
    news:[email protected]...
    > I'm trying yo count the number of occurances of a string in a variable
    > string
    > e.g look for "VVN" in TDCS0/VVN/8375 or mycompany/VVN/8375 or even
    > mycompany/TDCS0/VVN/8375. The text does not appear in the same location
    > each
    > time. so what i am looking for is countif(a1/a96="VVN anywhere in this
    > string")
    >
    > Excel 2002
    >
    > Help !
    >
    >
    >
    >
    >




  4. #4
    Bob Phillips
    Guest

    Re: How can I count strings within strings

    Hi Arvi,

    Why did you say

    =COUNTIF(A1:A96,"*"&"VVN"&"*")

    instead of

    =COUNTIF(A1:A96,"*VVN*")

    just wondering?

    Bob

    "Arvi Laanemets" <[email protected]> wrote in message
    news:[email protected]...
    > Hi
    >
    > =COUNTIF(A1:A96,"*"&"VVN"&"*")
    >
    > --
    > Arvi Laanemets
    > ( My real mail address: arvil<at>tarkon.ee )
    >
    >
    > "Paul W" <[email protected]> wrote in message
    > news:[email protected]...
    > > I'm trying yo count the number of occurances of a string in a variable
    > > string
    > > e.g look for "VVN" in TDCS0/VVN/8375 or mycompany/VVN/8375 or even
    > > mycompany/TDCS0/VVN/8375. The text does not appear in the same location
    > > each
    > > time. so what i am looking for is countif(a1/a96="VVN anywhere in this
    > > string")
    > >
    > > Excel 2002
    > >
    > > Help !
    > >
    > >
    > >
    > >
    > >

    >
    >




  5. #5
    Arvi Laanemets
    Guest

    Re: How can I count strings within strings

    Hi Bob


    "Bob Phillips" <[email protected]> wrote in message
    news:[email protected]...
    > Hi Arvi,
    >
    > Why did you say
    >
    > =COUNTIF(A1:A96,"*"&"VVN"&"*")
    >
    > instead of
    >
    > =COUNTIF(A1:A96,"*VVN*")
    >
    > just wondering?


    :-))) Doctors are defining it as 'professinal cretinism', I think :-)))

    Seriously, I'm a bit busy today, and with my head full my own problems. I
    run trough my room for a moment, checked my question in programming NG, and
    meanwhile wrote an answer to OP's question. And now I have to run again!


    --
    Arvi Laanemets
    ( My real mail address: arvil<at>tarkon.ee )



    >
    > Bob
    >
    > "Arvi Laanemets" <[email protected]> wrote in message
    > news:[email protected]...
    >> Hi
    >>
    >> =COUNTIF(A1:A96,"*"&"VVN"&"*")
    >>
    >> --
    >> Arvi Laanemets
    >> ( My real mail address: arvil<at>tarkon.ee )
    >>
    >>
    >> "Paul W" <[email protected]> wrote in message
    >> news:[email protected]...
    >> > I'm trying yo count the number of occurances of a string in a variable
    >> > string
    >> > e.g look for "VVN" in TDCS0/VVN/8375 or mycompany/VVN/8375 or even
    >> > mycompany/TDCS0/VVN/8375. The text does not appear in the same location
    >> > each
    >> > time. so what i am looking for is countif(a1/a96="VVN anywhere in this
    >> > string")
    >> >
    >> > Excel 2002
    >> >
    >> > Help !
    >> >
    >> >
    >> >
    >> >
    >> >

    >>
    >>

    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1