+ Reply to Thread
Results 1 to 4 of 4

Searching with Excel Macro & Displaying Result

  1. #1
    Registered User
    Join Date
    10-04-2009
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    77

    Exclamation Searching with Excel Macro & Displaying Result

    Morning everyone, I was wondering if anyone knew a way I could do the following:

    I need to design a workbook for work, which the supervisor can use every day to add a new row of information.

    Basically, we deal with 14 branches. Each branch sends us stuff on a daily basis. There are 3 different types of information each branch can send. Let's say "X, Y and Z". We're wanting to trace how many X, Y and Z's each branch sends on a weekly and monthly basis so we can identify trends.

    So the worksheet looks as follows and is called "Daily Data"

    ........|BRANCH 1 |BRANCH 2 | BRANCH 3 |
    DATE | X | Y | Z | X | Y | Z | X | Y | Z |

    So I've made a userform which will allow the supervisor to input all this data in and each day it creates a new row with the date and then the amounts of X, Y and Z received for each branch.

    The supervisor will want to see a Weekly and a Monthly report of what has been received in total.

    We work monday to friday, so the dates will go for example 07/12/09 to 11/12/09 and then will skip to 14/12/09 to 18/12/09 and so on.

    So in the create weekly report userform, I first of all need a way to make the drop down menu only show the week beginnings i.e. only the dates which fall on a monday i.e. 07/12/2009, 14/12/2009 etc. And then when that week is selected, click a button and it pulls all the amounts of X, Y and Z for each branch over into a spreadsheet for monday-friday between that date range so you get a report of how many of X each branch has sent for that week, how many of Y, and how many of Z and then a total number.

    I'd like a report that would show for example... and that'd be the weekly total

    BRANCH X Y Z TOTAL
    BRANCH 1 2 1 0 3
    BRANCH 2 2 1 1 4
    BRANCH 3 3 0 2 5
    TOTAL 7 2 3 12

    I could easilly do all this in PHP... but my work does not have a way of supporting PHP and a MySQL database... so I need to see if there's a way to do it in excel.

    I'd be grateful if anyone can help :-) thanks in advance

  2. #2
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Searching with Excel Macro & Displaying Result

    My first though is a pivot table. This is especally sitable for this purpose.
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Searching with Excel Macro & Displaying Result

    Smurlos, you should re-think the way you're storing your data.

    You say you're conversant with MySQL etc and db design, XL is no different.

    Your storage table should work along the lines of:

    Date | Branch | Data Type | Value
    where Branch is 1,2,3 etc and Data Type is X/Y/Z

    you should thus have one transaction / row for every data type instance recorded.

    It may be preferable to add a further calculated field post Value, called Week which you can calculate in your UF VBA terms along lines of below pseudo-code:

    Please Login or Register  to view this content.
    (adjust that in red as appropriate)

    Then echoing Ricardo...

    With the table based approach you can push your data into a Pivot Table - have the Monday Field as a Page Filter, set Branch as Row Field and Data Type as Column Field ... use Data Type again but this time as Data Field and set to COUNT.

  4. #4
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Searching with Excel Macro & Displaying Result

    PT is not my specialty but here is an example.

    I have taken the Table layout into consideration.

    You can put a custom filter to the dates. Put you cursor at A6 and then press the arrow on A4.

    I will not have time today to help you out as we have "Sinterklaas" in the Netherlands and as I have three kids ...

    DO is more (understatement) than able to help you.
    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