+ Reply to Thread
Results 1 to 8 of 8

Monetary Unit Sampling (MUS) Coding help needed

  1. #1
    Registered User
    Join Date
    07-13-2017
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    12

    Monetary Unit Sampling (MUS) Coding help needed

    Hi guys,

    I have quite a tricky task to try and complete for my project. It is in relation to MUS.

    I've got a very handy article that explains how MUS chooses a sample - https://cplusglobal.wordpress.com/20...ple-selection/

    It's just creating a code/formula that can replicate this.

    Ideally, I'm looking for something that:

    1) Uses the sample size number (I've already worked out how to achieve this)
    2) When you press a button/activate a macro, generates your sample size from a list of transactions based on the requirements of MUS

    I apologise if this does not make much sense, but the link I provided above explains the process of what I'd like to achieve much clearer and accurate.

    Overall MUS can be quite taxing, however overall the code would need to replicate the features of MUS mentioned in the article to achieve the sample size (this is not just picking random numbers, as MUS uses a protocol of procedures also all mentioned in the article)

    I really hope I can have some assistance on this, and I would very much appreciate anyones help on this one.

    All the best,

    Nathan

  2. #2
    Registered User
    Join Date
    02-08-2017
    Location
    Scotland
    MS-Off Ver
    Office 365
    Posts
    21

    Re: Monetary Unit Sampling (MUS) Coding help needed

    Nathan, reading the article in the link and looking at the first screenshot in there, I guess you want to re-create that spreadsheet? I see the risk of circular calculation if you try to solve this with formula's. A bit of VBA is most likely a lot easier. Example attached
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    07-13-2017
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    12

    Re: Monetary Unit Sampling (MUS) Coding help needed

    Quote Originally Posted by RdwJ View Post
    Nathan, reading the article in the link and looking at the first screenshot in there, I guess you want to re-create that spreadsheet? I see the risk of circular calculation if you try to solve this with formula's. A bit of VBA is most likely a lot easier. Example attached
    Hi RdwJ,

    Firstly, I would like to say I very much appreciate your assistance with this issue. The spreadsheet you've attached works just as the article screenshot shows.

    I used the IDEA Software to calculate the sample size and generate a sample and compared the results of it against the spreadsheet you provided and they were very similar which is indeed pleasing.

    The only issue outstanding which I think would clear up any differences would be how to calculate a random start?

    On the previous page - https://cplusglobal.wordpress.com/20...-sampling-mus/

    It does talk of how to pick a random start from systematic selection, however I am unsure how to make this a uniform process (ie: work on different lengths of data)

    If you could help me on this (you can see their random start, process etc on the link provided and the one earlier provided) then this would be most helpful.

    Thank you again for what you've already done, I do really appreciate it.

    All the best,

    Nathan

  4. #4
    Registered User
    Join Date
    07-13-2017
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    12

    Re: Monetary Unit Sampling (MUS) Coding help needed

    After some research, I think I understand the principle behind a random start. This Wikipedia gave quite a good explanation - https://cplusglobal.wordpress.com/20...-sampling-mus/

    Is it fundamentally generating a completely random number between 1 and whatever the sampling interval is?

    Ie: My sample size is 5
    - My total population value (sum of the data being tested) is 100

    Therefore the sampling interval is (100/5) 20.

    So, the random start can be any number between 1 and 20

    If this is correct, I would just need a piece of code that would generate a random start (pick a random number) between what the sampling interval is and 1?

  5. #5
    Registered User
    Join Date
    02-08-2017
    Location
    Scotland
    MS-Off Ver
    Office 365
    Posts
    21

    Re: Monetary Unit Sampling (MUS) Coding help needed

    Reading from the link "The random start would be a value between $1 and the sampling interval."
    If you use the formula =RANDBETWEEN(0,Sampling_Interval) then every time the spreadsheet is calculated (or if you press <F9> a new Random Start will be generated. Note that "Sampling_Interval" is cell E3.

  6. #6
    Registered User
    Join Date
    02-08-2017
    Location
    Scotland
    MS-Off Ver
    Office 365
    Posts
    21

    Re: Monetary Unit Sampling (MUS) Coding help needed

    Back to MUS, what I read is that indeed the sampling interval is cumulative monitory value devided by sample size, with "Random start" a random number between 0 and the sampling value.

  7. #7
    Registered User
    Join Date
    02-08-2017
    Location
    Scotland
    MS-Off Ver
    Office 365
    Posts
    21

    Re: Monetary Unit Sampling (MUS) Coding help needed

    and note that the macro does not clear existing entries, i.e. you need to remove the old answers before running the macro again....

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Monetary Unit Sampling (MUS) Coding help needed

    Another way, sans VBA:

    A
    B
    C
    D
    E
    4
    Start
    112.00
    D4: =RANDBETWEEN(0, D5)
    5
    Interval
    500.00
    D5: Input
    6
    7
    Item
    Amt
    Cumu
    Sample
    8
    1
    147.40
    147.40
    x
    C8 and down: =SUM(C7, (B8>0)*B8)
    9
    2
    72.13
    219.53
    D8 and down: =IF(INT((C8-D$4)/D$5) > INT((N(C7) - D$4)/D$5), "x", "")
    10
    3
    96.51
    316.04
    11
    4
    158.80
    474.84
    12
    5
    136.24
    611.08
    13
    6
    14.80
    625.88
    x
    14
    7
    61.17
    687.05
    15
    8
    61.33
    748.38
    16
    9
    224.10
    972.48
    17
    10
    293.30
    1265.78
    x
    18
    11
    3.18
    1268.96
    19
    12
    82.01
    1350.97
    20
    13
    3.77
    1354.74
    21
    14
    89.95
    1444.69
    22
    15
    124.70
    1569.39
    23
    16
    77.19
    1646.58
    x
    24
    17
    99.07
    1745.65
    25
    18
    98.74
    1844.39
    26
    19
    252.27
    2096.66
    27
    20
    216.18
    2312.84
    x
    28
    21
    220.16
    2533.00
    29
    22
    (46.93)
    2533.00
    30
    23
    10.83
    2543.83
    31
    24
    296.29
    2840.12
    x
    Entia non sunt multiplicanda sine necessitate

+ 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: 15
    Last Post: 11-23-2016, 03:16 PM
  2. Replies: 4
    Last Post: 10-07-2015, 06:04 AM
  3. [SOLVED]Function to add total monetary values within a row.
    By communistflamingo in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-31-2014, 03:20 PM
  4. [SOLVED] Unit increase relative to variable unit thresholds
    By Fr3dle in forum Excel General
    Replies: 6
    Last Post: 07-01-2013, 06:57 AM
  5. Need Help with coding that can reads unit prices on supermarkets websites.
    By Nickvii777 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-30-2013, 02:26 PM
  6. VBA coding of Userform help needed please
    By Alexph in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-03-2012, 04:16 AM
  7. Excel Coding Help Needed
    By april73 in forum Excel General
    Replies: 4
    Last Post: 07-28-2011, 02:17 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