Results 1 to 7 of 7

Thread: Add between 10% to 20% random to numbers in cloumn F

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,709
    Location
    The result will be between 10.00000000000% and 20.99999999999% increase
    Option Explicit
    
    Sub AddToF()
    Dim FArr
    Dim i As Long
    
    FArr = Intersect(Range("F1").CurrentRegion, Range("F:F")).Value
    
    For i = 1 To UBound(FArr)
        If IsNumeric(FArr(i, 1)) Then _
            FArr(i, 1) = FArr(i, 1) * 1 + (Int((20 - 10 + 1) * Rnd + 10) / 100)
    Next i
    
    Range("F1").Resize(UBound(FArr, 1)) = FArr
    End Sub
    Example Returns, as percent additions:
    10.999999940395400%
    14.000000059604600%
    18.000000715255700%
    14.000000059604600%
    15.999999642372100%
    18.000000715255700%
    17.000000178813900%
    11.999999731779100%
    15.000000596046400%
    18.999999761581400%
    11.999999731779100%
    15.999999642372100%
    15.000000596046400%
    12.999999523162800%
    20.000000298023200%
    10.999999940395400%
    17.000000178813900%
    15.999999642372100%
    17.000000178813900%
    14.000000059604600%
    12.999999523162800%
    14.000000059604600%
    10.000000149011600%
    Last edited by SamT; 07-16-2021 at 10:00 AM.
    Please take the time to read the Forum FAQ

Posting Permissions

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