Consulting

Results 1 to 11 of 11

Thread: Data referencing problem

  1. #1
    VBAX Newbie
    Joined
    Oct 2008
    Posts
    4
    Location

    Data referencing problem

    Hi all, i am a beginner in the vba environment who knows very little compared to most of you. Which is why i am seeking all your wisdom and experience in solving a few problems i'm facing right now.

    Firstly, a little background of my problem (as attached):

    In Sheet A, I have a table which shows the Names, Type of fruits and Date Purchased.

    There are 4 names and 3 Types of fruits in total

    Names: Alan, Tom, Alicia, John

    Types of fruits: Apples, Pears, Oranges

    In Sheet B, I would like to have a table which will sum up all of each type of fruits bought by each Name across all dates. As well as the earliest date that Name bought that type of fruit

    For example: How many Apples did Alan buy across all dates
    How many Apples did John buy across all dates
    How many Oranges did Alicia buy across all dates

    I'm hoping to automate the entire process with an assigned button in Sheet A. It is clearer if you look at the file I've attached. Hope my description is clear enough for all you guys to understand. Thanks in advance!

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    What's wrong with the formulae that you already have?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Newbie
    Joined
    Oct 2008
    Posts
    4
    Location
    The formula is fine, i'm just looking to automate the entire process as per my boss's request

  4. #4
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,198
    Location
    Could you not use a pivot table?
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved
    Click here for a guide on how to upload a file with your post

    Excel 365, Version 2403, Build 17425.20146

  5. #5
    VBAX Newbie
    Joined
    Oct 2008
    Posts
    4
    Location
    I've tried, but he seems to want something impressive to make himself look good in front of senior management. is there anyway we can do tt via vba?

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    A pivot is hugely impressive, especially whenyou start drilling-down/up and showing different data so easily.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,198
    Location
    Looks very pretty to me, pleasing and attractive to the eye (as pretty as excel gets that is, i do have a partner!)
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved
    Click here for a guide on how to upload a file with your post

    Excel 365, Version 2403, Build 17425.20146

  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Attractive, yeah, but look at those dropdown arrows. They allow you to filter on any on the data items.

    And Excel gets far mor attractive than that.

    3 clicks ...
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  9. #9
    VBAX Master CreganTur's Avatar
    Joined
    Jan 2008
    Location
    Greensboro, NC
    Posts
    1,676
    Location
    Quote Originally Posted by xld
    And Excel gets far mor attractive than that.
    Beer goggles, bob?


    xxxr,

    I only dabble in Excel, but I completely agree with the others here. Why reinvent the wheel when you have an excellent tool at your disposal already? To duplicate via VBA what you can already do with a pivot chart would be a rather massive undertaking.
    -Randy Shea
    I'm a programmer, but I'm also pro-grammar!
    If your issue is resolved, please use Thread Tools to mark your thread as Solved!

    PODA (Professional Office Developers Association) | Certifiable | MOS: Access 2003


  10. #10
    VBAX Newbie
    Joined
    Oct 2008
    Posts
    4
    Location
    thanks for the input lads, worked like a charm and my boss is fairly pleased with it. But i have another issue with the pivot table.

    Let's say a particular Name bought Apples across 3 dates, how do i show the minimum of those dates?

  11. #11
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    The minimum is the first in the last because it is ordered.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •