+ Reply to Thread
Results 1 to 12 of 12

Counting rows with two pieces of information

  1. #1
    Registered User
    Join Date
    11-25-2007
    Location
    Peterborough, UK
    Posts
    6

    Counting rows with two pieces of information

    I need a sum to count how many rows have a word from field Alpha in one column as well as a number from field Beta in another column.

    Anyone know how I would do this?

    Thanks

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    See if this helps

    Sums range B1 to B10 if A1 to A10 equals Alpha

    =SUMPRODUCT(--(A1:A10="Alpha")*(B1:B10))
    Note: Sumproduct doesn't allow you to use the whole Column

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    11-25-2007
    Location
    Peterborough, UK
    Posts
    6
    Thankyou for looking and helping but that isnt looking for field Beta in another column

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Are you saying the word Beta is in Col B and your summing a third column ??

    A sample of your data and cols etc would help

    VBA Noob

  5. #5
    Registered User
    Join Date
    11-25-2007
    Location
    Peterborough, UK
    Posts
    6
    Quote Originally Posted by VBA Noob
    Are you saying the word Beta is in Col B and your summing a third column ??

    A sample of your data and cols etc would help

    VBA Noob

    Sorry if Im not explaining it well

    a third column has no relevence at all, i want to know how many ROWs have Alpha field in Column A as well as Beta Field in column B.

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    No example so guessing again

    This will count the string Alpha Field in Col A and Beta Field in Col B if there in the same row

    =SUMPRODUCT(--(A1:A10="Alpha Field")*(B1:B10="Beta Field"))
    VBA Noob

  7. #7
    Registered User
    Join Date
    11-25-2007
    Location
    Peterborough, UK
    Posts
    6
    Quote Originally Posted by VBA Noob
    No example so guessing again

    This will count the string Alpha Field in Col A and Beta Field in Col B if there in the same row



    VBA Noob

    Yay, I think we are nearly there, Thankyou lots.

    However I am getting the result 0 but I know some of these rows exist.

    Is that sum you gave me just counting columns with the words Alpha Field or is it counting columns with any of the words in the list I have set named Alpha Field?

    maybe 'field' isnt the word but I dont know what is, its a while since I last worked on this.

  8. #8
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Post a example so I can see. Can't keep guessing all night

    VBA Noob

  9. #9
    Registered User
    Join Date
    11-25-2007
    Location
    Peterborough, UK
    Posts
    6
    Here is an example of what I meant, 'field' was the wrong word.

    see how this list of words has been named Fruitlist

    http://www.contextures.com/images/DV07.gif

    I need to count how many rows have a word from one list in one column as well as a number from another list in a different column.
    Last edited by Mog666; 11-25-2007 at 02:20 PM.

  10. #10
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    So you have two named ranges called "Alpha" and "Beta" and you want to count when each row isn't blank

    =SUMPRODUCT(--(Alpha<>"")*(Beta<>""))
    VBA Noob

  11. #11
    Registered User
    Join Date
    11-25-2007
    Location
    Peterborough, UK
    Posts
    6
    Quote Originally Posted by VBA Noob
    So you have two named ranges called "Alpha" and "Beta" and you want to count when each row isn't blank



    VBA Noob

    You've lost me, however you have helped with half my problem with your previous answer, I just need to change it somehow so thankyou I will continue researching.

  12. #12
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    You've lost me
    You lost me first. If you took the time to upload a sample file as I've being asking you would of got an answer by now

    VBA Noob

+ 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