+ Reply to Thread
Results 1 to 7 of 7

VBA code to count specific values

  1. #1
    Forum Contributor
    Join Date
    08-08-2012
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    196

    VBA code to count specific values

    Dear all,


    I would like to request, if it is possible to create a macro following the logic and example explained below:


    “count how many times specific variable (i.e "JPM", "BAML", "DM") in column C has occurred for the following strings ("ABS", "CMBS", "CLO") in column D"

    The input and output of sample data can be seen in the attachment below:

    Deals_count.xlsm


    Any help and guidance to this problem would be very much appreciated.

    Thank you for your time and help in advance.

    Kind regards
    Misbah

  2. #2
    Forum Contributor
    Join Date
    08-23-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    163

    Re: VBA code to count specific values

    Hi,

    Do you really need macro for this...? looks like this can be done with countifs.

    Please check the attached sheet.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    08-08-2012
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    196

    Re: VBA code to count specific values

    Dear all,

    I would like the output to be displayed in "Sheet2", but I cannot get the formula below to work:

    Please Login or Register  to view this content.

    If possible, can this formula be covnerted into VBA code?

    Thank you for your help and time.
    Last edited by missy22; 11-27-2012 at 08:23 AM.

  4. #4
    Forum Contributor
    Join Date
    08-08-2012
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    196

    Re: VBA code to count specific values

    Could anyone please provide any assistant/help to the above post.

    Thank you in advance

  5. #5
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: VBA code to count specific values

    Just mark the yellow field, select Cut and paste it on Sheet2.
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  6. #6
    Forum Contributor
    Join Date
    08-08-2012
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    196

    Re: VBA code to count specific values

    Dear all,

    I have updated data, however the formula below does no seem to picking up correct count values in Sheet4 (please attachment).

    Please Login or Register  to view this content.
    The sample workbook shows:
    Count_formula_updated.xls

    Sheet 1 --> input data source

    Sheet 4 --> output table with formula

    The highlighted row in Sheet4, shows one of many values which has not picked up all the count.

    I am not sure why the formula is not picking up accurate count values for specific values .

    Any help would be very much appreciated.

    Thank you for your time and help.

  7. #7
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: VBA code to count specific values

    It's really a shame that posts like these just flow down the stream without anyone noticing. Well defined problem, polite threadstarter...

    By now it's probably too late but hey...

    There was an error in that some of the cells containing ABS RMBS CLO CDO CMBS was preceded by a space. The cells that the formula uses as reference that is.

    As long as it wasn't first in the cell in the datarange it would pick it up but if it was first it was not preceded by a space and would not be counted.
    Attached Files Attached Files

+ 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