+ Reply to Thread
Results 1 to 11 of 11

adjusting datasets

  1. #1
    Registered User
    Join Date
    09-09-2014
    Location
    london, england
    MS-Off Ver
    2013
    Posts
    6

    Question adjusting datasets

    I wish to adjust a number of datasets; is it possible to have an excel formula to do the following?

    If X is >= 0.049 then deduct a random number from X so that X is in the range 0.020 to 0.049. Thanks.

  2. #2
    Forum Contributor
    Join Date
    03-17-2005
    Location
    Canterbury, Kent
    MS-Off Ver
    2003, 2010
    Posts
    285

    Re: adjusting datasets

    Hi Paul

    Is this what you are after?

    =IF(B23>=0.049,B23-RANDBETWEEN(0.02,0.049),B23)

    B23 is the cell containing the X value in your example.

    Windy

  3. #3
    Registered User
    Join Date
    09-09-2014
    Location
    london, england
    MS-Off Ver
    2013
    Posts
    6

    Question Re: adjusting datasets

    Windy

    Thanks. not quite.

    I have tried it but it is returning negative values when the X cell value is greater than 0.049.

    eg

    0.028 0.028
    0.034 0.034
    0.047 0.047
    0.053 -0.947
    0.058 -0.942
    0.065 -0.935
    0.069 -0.931

    the new value should also be between 0.02 to 0.048.

    Regards

    Paul

  4. #4
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: adjusting datasets

    Quote Originally Posted by PaulALC View Post
    If X is >= 0.049 then deduct a random number from X so that X is in the range 0.020 to 0.049. Thanks.
    Couldn't you just set it to a random number between 0.020 nd 0.049 directly?

    eg

    =IF( "X" >= 0.049, RANDBETWEEN(0.020, 0.049), "X" )

  5. #5
    Registered User
    Join Date
    09-09-2014
    Location
    london, england
    MS-Off Ver
    2013
    Posts
    6

    Re: adjusting datasets

    Ben

    I have tried that but am getting the following 1.000 in the third column using your suggestion.

    0.052 -0.948 1
    0.026 0.026 0.026
    0.024 0.024 0.024
    0.035 0.035 0.035
    0.062 -0.938 1
    0.052 -0.948 1
    0.057 -0.943 1
    0.027 0.027 0.027
    0.037 0.037 0.037


    Regards

    Paul

  6. #6
    Forum Contributor
    Join Date
    03-17-2005
    Location
    Canterbury, Kent
    MS-Off Ver
    2003, 2010
    Posts
    285

    Re: adjusting datasets

    Paul

    If you can add a column that contains the numbers between 0.020 & 0.049 (this can be hidden)

    You could then try this:

    =IF(A1>=0.049,INDIRECT("V"&RANDBETWEEN(1,29)),A1)

    The A1 is the number you are testing.
    The "V" is the column containing the numbers between 0.020 & 0.049.
    The 1,29 refers to the rows used.

    The problem I can foresee is it will recalculate when something changes.

    Windy

  7. #7
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: adjusting datasets

    Oh, right, RANDBETWEEN only does integers. I forgot about that.

    Use this instead.

    =IF("X" => 0.049, RAND() *0.029 +0.02, "X")

  8. #8
    Registered User
    Join Date
    09-09-2014
    Location
    london, england
    MS-Off Ver
    2013
    Posts
    6

    Re: adjusting datasets

    Sorry Windy

    I cannot see the wood for the tress. I have attached an example sheet.

    Regards

    Paulbook 1 data.xlsx

  9. #9
    Forum Contributor
    Join Date
    03-17-2005
    Location
    Canterbury, Kent
    MS-Off Ver
    2003, 2010
    Posts
    285

    Re: adjusting datasets

    Paul

    I know what you mean. I looked at your example for ages before I saw the problem.

    Your formula is missing a set of quotation marks

    =IF(D4>=0.049,INDIRECT(M&RANDBETWEEN(4,32)),D4)
    it should read...
    =IF(D4>=0.049,INDIRECT("M"&RANDBETWEEN(4,32)),D4)

    Windy

  10. #10
    Registered User
    Join Date
    09-09-2014
    Location
    london, england
    MS-Off Ver
    2013
    Posts
    6

    Re: adjusting datasets

    Thanks Windy, Thanks Ben.

  11. #11
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: adjusting datasets

    You could simply divide RANDBETWEEN by 1000:
    =IF( "X" >= 0.049, RANDBETWEEN(20, 49)/1000, "X" )
    Remember what the dormouse said
    Feed your head

+ 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. Comparission of two datasets
    By Michael Siglev in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-04-2013, 05:15 AM
  2. Toggling between datasets
    By letangerang58 in forum Excel General
    Replies: 2
    Last Post: 05-01-2013, 10:36 AM
  3. Excel 2007 : merge two datasets
    By unjung whang in forum Excel General
    Replies: 0
    Last Post: 02-25-2011, 05:23 PM
  4. Normalize datasets
    By jorgeneriksen in forum Excel General
    Replies: 2
    Last Post: 01-27-2011, 11:06 AM
  5. Merger of two datasets
    By [email protected] in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 10-08-2010, 12:39 PM

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