+ Reply to Thread
Results 1 to 6 of 6

vba to count cells

  1. #1
    Forum Contributor
    Join Date
    11-17-2015
    Location
    India
    MS-Off Ver
    2013
    Posts
    365

    vba to count cells

    need vba for following task.

    I have family id in column "E"
    In column "J" I have details of their family members
    I want to count of total family member including proposer against each proposer in column K
    desired result mentioned on column k

    Also please provide if any simple formula is available.
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: vba to count cells

    This regular formula will do the count for you...
    =COUNTIF($E$2:$E$24,E2)

    You could add in the text as needed

    edit: this will add teh text and scip the repeated rows...
    =IF(E2=E1,"","Total Family Member = "&COUNTIF($E$2:$E$24,E2))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Valued Forum Contributor
    Join Date
    12-22-2015
    Location
    HK
    MS-Off Ver
    2010
    Posts
    532

    Re: vba to count cells

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    11-17-2015
    Location
    India
    MS-Off Ver
    2013
    Posts
    365

    Re: vba to count cells

    HI, Thank you for the code. It works nicely. But the code calculates the id no from column “E”. Problem is that I have duplicate ID as well.

    SO I want the formula to count Column “J” to count the number of cell starts from “PROPOSER” to the end of next “PROPOSER” and give result. Do not count next “Proposer” count before the next from one “Proposer” to before next “Proposer”


    Please refer attachment from from row no.25. you can duplicate id as well (newly added)
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    12-22-2015
    Location
    HK
    MS-Off Ver
    2010
    Posts
    532

    Re: vba to count cells

    For formula : [k2]==IF(J2="PROPOSER",IFERROR(MATCH("PROPOSER",J3:$J$37,0),ROWS(J2:$J$37)),"")

    By the way give you one more code:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    10-02-2003
    Location
    Kuwait
    MS-Off Ver
    2016
    Posts
    46

    Re: vba to count cells

    Dear ikboy,
    I am new to VBA and trying to learning it by reading solved problems in the forum. Can u please explain the code u have written here for better understanding for a newbie? Especially d = CreateObject("scripting.dictionary"), UBound(arr), d(i),k = d.keys: t = d.items: j = UBound(arr) etc. These are new concepts to me. If at all my queries bothers your valuable time, please ignore
    Regards,

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Count if: Compare 2 ranges and count where cells in same row differ
    By ExcelFed in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-15-2014, 02:34 PM
  2. [SOLVED] Count formula not count hidden cells in table
    By tlacloche in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-06-2013, 02:35 PM
  3. [SOLVED] Formula needed to only count total cells entered and not count adjacent text entered cells
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-07-2013, 06:22 PM
  4. [SOLVED] count cells that contain text but do not count cells containing only a formula
    By cprpacific in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-13-2013, 03:15 PM
  5. [SOLVED] Count in a range, where identical adjacent cells count as one instance.
    By the-algebraist in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-05-2013, 11:18 AM
  6. [SOLVED] count occupied cells, but put count total in different worksheet
    By NewbieOfVBA in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-24-2012, 07:30 PM
  7. Replies: 2
    Last Post: 06-24-2010, 04:53 PM

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