+ Reply to Thread
Results 1 to 4 of 4

Extract and count data - macro

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

    Extract and count data - macro

    Dear all,
    I am writing to seek help, in creating a macro which can count specific data and display the count in another sheet, by matching up the same date from sheet1 and sheet2.

    for example, I have data in sheet1 (q_type & d_type), and i would like the macro, to be able to find and extract all data from the date[16/06] types from sheet1 and count all the d-types [LO], which have q_type of [CV, TK, TR]. then display the count for each q_type's in sheet2, under the same date [16/06] in row 1 of sheet2.

    I have attached a sample data in sheet1 and desired output in sheet2, for date [16/06], for further reference.
    sample1.xlsm

    desired sheet2 output:
    LO TK 2
    LO CV 1
    LO TR 2


    many thanks for your help and time.

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Extract and count data - macro

    Why not just use a pivot table?
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Extract and count data - macro

    Hi
    I dont think you need a macro if I understand you correctly as you can use a Pivot Table to achieve what you are after. See attached sample, hope it helps.
    Good luck
    Tony
    Attached Files Attached Files

  4. #4
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Extract and count data - macro

    Try this:-
    The code assumes that Data in Sheet(2), row(1) and columns "A & B" exist.
    Please Login or Register  to view this content.
    Regards Mick
    NB:- Slight mod forgot to add the totals
    Last edited by MickG; 06-16-2014 at 07:21 AM.

+ 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. [SOLVED] Pausing A Macro (allow user to extract data) aAnd Resume Macro
    By jbumps in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2013, 01:59 PM
  2. How to count and extract data from tables in excel
    By segzyoau in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-15-2012, 12:34 PM
  3. How to Extract Data using Macro?
    By da80th in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-19-2007, 06:39 AM
  4. Macro to extract data
    By Bill A in forum Excel General
    Replies: 3
    Last Post: 02-15-2006, 08:35 AM
  5. Extract & count data from Access program
    By ncron in forum Excel General
    Replies: 1
    Last Post: 02-04-2006, 06:29 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