+ Reply to Thread
Results 1 to 12 of 12

indentify status text in ne colum and count in another if

  1. #1
    Registered User
    Join Date
    04-18-2012
    Location
    Cph, DK
    MS-Off Ver
    Excel 2010
    Posts
    14

    indentify status text in ne colum and count in another if

    Hi!

    I know next to nothing about vb programming, but nevertheless i have tried to compile a function it although contains an error which i can't identify.

    Please Login or Register  to view this content.
    Hope someone can and will help... thx
    Last edited by Slowfish; 04-23-2012 at 09:42 AM.

  2. #2
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: indentify status text in ne colum and count in another if

    You have two "for"s and only one "next". You need a next for each for.

    Please Login or Register  to view this content.
    Also, you are using "cell" twice, once as part of varRange, and once as part of subRange. You can solve this with cell1 and cell2.

  3. #3
    Valued Forum Contributor
    Join Date
    11-11-2008
    Location
    Euro
    MS-Off Ver
    2007, 2010
    Posts
    470

    Re: indentify status text in ne colum and count in another if

    Quote Originally Posted by Slowfish View Post
    Hi!

    I know next to nothing about vb programming, but nevertheless i have tried to compile a function it although contains an error which i can't identify.
    Hope someone can and will help... thx
    there is only one cell variable that make confusing (a share variable)

    May be
    Please Login or Register  to view this content.
    Best regard, -)iger-/iger
    If you are pleased with a solution mark your post SOLVED.

  4. #4
    Registered User
    Join Date
    04-18-2012
    Location
    Cph, DK
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: indentify status text in ne colum and count in another if

    Thanks... I still really dont know what to do. I just derived and compiled the function based on what i have seen in other vb functions, but clearly I haven't understood a fraction of what is needed. Can you help me rewrite it? plz...

  5. #5
    Registered User
    Join Date
    04-18-2012
    Location
    Cph, DK
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: indentify status text in ne colum and count in another if

    Thanks tiger, but it still gives me an error in the 4th line closest to the end:

    Next If Cell2 .Text = strText Then Countcolorif = Countcolorif + 1

  6. #6
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: indentify status text in ne colum and count in another if

    P.S. I'm not for sure what you want, but the syntax here is correct.

    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: indentify status text in ne colum and count in another if

    it still gives me an error in the 4th line closest to the end:

    Next If Cell2 .Text = strText Then Countcolorif = Countcolorif + 1
    What is Countcolorif?

    Please Login or Register  to view this content.
    Here Countcoloriftext is the function which returns a long variable.

  8. #8
    Registered User
    Join Date
    04-18-2012
    Location
    Cph, DK
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: indentify status text in ne colum and count in another if

    Thanks for input... StevenM yours almost worked.

    I have attached an example:

    example.xlsm

    I need to count the number of active/inactive subscriptions.
    Last edited by Slowfish; 04-23-2012 at 10:39 AM.

  9. #9
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: indentify status text in ne colum and count in another if

    Well the answers are:

    Active & A = 9, because 3 actives * 3 As = 9
    Active & B = 6, because 3 actives * 2 Bs = 6
    Inactive & A = 6, because 2 inactives * 3 As = 6
    Inactive & B = 4, because 2 inactive * 2 Bs = 4

    So where is the problem?

  10. #10
    Valued Forum Contributor
    Join Date
    11-11-2008
    Location
    Euro
    MS-Off Ver
    2007, 2010
    Posts
    470

    Re: indentify status text in ne colum and count in another if

    Quote Originally Posted by Slowfish View Post
    Thanks for input... StevenM yours almost worked.

    I have attached an example:

    Attachment 151933

    I need to count the number of active/inactive subscriptions.
    Why don't use the COUNTIFS function, like this
    =+COUNTIFS($B$11:$B$15,E$5,$D$11:$D$15,$D6)
    for E6
    copy it for the last cells in E and F column

  11. #11
    Registered User
    Join Date
    04-18-2012
    Location
    Cph, DK
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: indentify status text in ne colum and count in another if

    Lolz Tigertiger! This is second time today you have made my live simpler Thanks a lot...

  12. #12
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: indentify status text in ne colum and count in another if

    How about?

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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