+ Reply to Thread
Results 1 to 3 of 3

Random numbers to generate amount between two numbers

  1. #1
    Registered User
    Join Date
    09-08-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    1

    Random numbers to generate amount between two numbers

    Hello,
    I have to build an excel sheet to do an invoice.
    I know the total amount and the quantities for the items in the invoice.
    I have to generate random prices for them , but the total amount should be between 7000-7800, and if the quantity is bigger for an item, the price should be smaller.
    Any ideeas?
    Thanks.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    09-08-2010
    Location
    Montenegro
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: Random numbers to generate amount between two numbers

    Well, I can think of one simple way: your invoice in attachment has 12 lines; if it's always the case, you can assign the equal amount to each line, dividing total amount in C15 with 12, and then dividing it with quantity, so to get price for each item.\

    In this example, in cell C3 you should type

    =$C$15/(12*B3)

    And then just copy it down in all range, C3 through C14.

    If somebody inspects it, will see that amount quantity*price is equal for each row, so you may slightly change it, by not simply dividing total amount with 12, but assigning it different percentages of total amount, but to have 100% at the end; I mean, dividing by 12 means multiplying with 0.8333; instead, you may multiply each row with, let's say, 0.10, 0.07, 0.08, 0.05, 0.15, 0.06, 0.10, 0.17, 0.02, 0.09 and 0.11, which at the end sums up to the same total.

    Also, if the number of lines is not always the same, then you may set additional cell, let's say D2, where you may enter number of lines for that specific case; then formula in cell C3 is

    =$C$15/($D$2*B3)

    But in this case it's not p[ossible to variate difference between lines like in nabove example, all lines will have the same subtotal amount.

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Random numbers to generate amount between two numbers

    If each line item can have the same base price, you can SUM Column B in B15, in C15 put

    =RANDBETWEEN(7000/B15,7800/B15)

    and in C3:C14

    =IF(ISNUMBER(B3),$C$15*B3,"")

    Does that work for you?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

+ 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