Thread: Rand and If
View Single Post
 
Old 01-03-2018, 12:39 PM
NBVC's Avatar
NBVC NBVC is offline Windows 10 Office 2013
The Formula Guy
 
Join Date: Mar 2012
Location: Mississauga, CANADA
Posts: 215
NBVC will become famous soon enoughNBVC will become famous soon enough
Default

You can add a MIN() function around it so that it takes the Minimum of the RANDBETWEEN() result or the result in H3.

=MIN($H$3,IF($C$10=1,RANDBETWEEN(1,9),IF($C$10=2, RANDBETWEEN(10,99),IF($C$10=3,RANDBETWEEN(100,999) ,IF($C$10=4, RANDBETWEEN(1000,9999),RANDBETWEEN(10000,99999)))) ))
Reply With Quote