+ Reply to Thread
Results 1 to 5 of 5

Copy number of distinct values and their details from one sheet to another.

  1. #1
    Registered User
    Join Date
    09-03-2013
    Location
    hyderabad
    MS-Off Ver
    Excel 2010
    Posts
    12

    Copy number of distinct values and their details from one sheet to another.

    Hi All,

    I am bit new to excel programming and Stuff. I am facing some issue in a Task Can you please help

    Data:

    There are two sheets : Sheet1 is Input and Sheet 2 is Output.

    Sheet 1 has following columns.

    Item Shop Buyer Quantity in Jan Quantity in Feb

    In my sheet if I filter by a Shop for example "Shop 1" . I get the following data

    Shop Vehicle Buyer Quantity in Jan Quantity in Feb
    Shop1 Car Jim 1 5 5
    Shop1 Car Nick 5 6 9
    Shop1 Scooter Jim 7 8 0
    Shop1 Cycle Mary 9 0 0

    Now I need the following :

    1.Number of distinct vehicles purchased from "Shop 1" and place it in the Sheet "Distinct".
    2.Sum of "Quantity in Jan" in sheet "Input" for all vehicles purchased from Shop1 and place in sheet distinct.

    Following is the example values in Sheet "Distinct"


    Shop Number of Distinct Vehicles Total Quantity in Jan
    Shop1 3 22
    Shop2
    Shop3

    Also Attached is the sheet.

    Thanks.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Copy number of distinct values and their details from one sheet to another.

    I re-aranged the data with an macro.

    After that I used pivot table to get the result.

    See the attached file.

    Please reply.
    Attached Files Attached Files
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    09-03-2013
    Location
    hyderabad
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Copy number of distinct values and their details from one sheet to another.

    Thanks for the reply oeldere,

    your approach is very good, but here it is slightly deviating from my requirement. Can I please have data in Sheet "Distinct"> In the format specified below . Also Can I have a solution for this without the use of macros.? (If we have to use macro it will be fine but I need data in the format specified.)



    Shop Number of Distinct Vehicles Total Quantity in Jan
    Shop1 3 22
    Shop2
    Shop3


    Thanks in Advance.

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Copy number of distinct values and their details from one sheet to another.

    Maybe other members have a smart formula solution.

    I would go for the given option.

  5. #5
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Copy number of distinct values and their details from one sheet to another.

    Taj, try these.

    Define two more names Shop & Vehicle with appropriate ranges. Then in;

    Distinct A2:

    =IFERROR(INDEX(Shop,MATCH(TRUE,INDEX(ISNA(MATCH(Shop,A$1:A1,0)),),0)),"")

    B2:

    =IF(A2="","",SUMPRODUCT((Shop=A2)*(Vehicle<>"")*ISNUMBER(1/(MATCH(Vehicle&"_"&A2,Vehicle&"_"&Shop,0)=ROW(Shop)-MIN(ROW(Vehicle))+1))))

    C2:

    =IF($A2="","",SUMIF(Shop,$A2,INDEX(Data,,MATCH("*"&RIGHT(C$1,3),Headers,0))))

    Copy A2:C2 then copy down.

    IFERROR only works with Excel 2007 or above. A per you profile assuming you are using Excel 2010.
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

+ 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. Replies: 2
    Last Post: 01-21-2013, 12:07 AM
  2. Replies: 1
    Last Post: 07-15-2012, 06:31 AM
  3. Copy row details a number of times
    By bob_caw in forum Excel General
    Replies: 2
    Last Post: 07-11-2012, 04:57 AM
  4. copy of some cell details to other sheet
    By ss_bb_24 in forum Excel Programming / VBA / Macros
    Replies: 30
    Last Post: 01-05-2009, 06:04 AM

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