2014 Archives by date, by thread · List index

# Re: [libreoffice-users] Re: How to insert a field of a random integer [of specified length]

```At 03:31 26/04/2014 -0700, Alf Noname wrote:
```
```I created a Libre Office Calc spreadsheet with a table like this:

Rand2DiG        91
Rand3DiG        725
Rand4DiG        5869
Rand5DiG        61431
Rand6DiG        872247

where the 2nd column formula are defined like this:
=ROUND(RAND()*89)+10
=ROUND(RAND()*899)+100
=ROUND(RAND()*8999)+1000
```
```
```
Incidentally, these formulae may not do exactly what you want. RAND()*89 gives a number in the range 0 to 89 and when you ROUND it you get an integer in the range 0 to 89, but zero and 89 are only half as likely to occur as all the other numbers. Only zero to a half produces zero, but a half to one-and-a-half - twice as likely - produces one, and so on. When you have added 10, it's 10 and 99 that are each half as likely as the rest. If you want a uniform distribution, try something like =INT(RAND()*90)+10 etc.
```
```
Following your solution I get the entire table (2 col. x 5 lines) in my Writer document. But I want to insert only the content of one of the second column (the random integer), the value only without any text/cell format from the spreadsheet document. The insert position format in the Writer document should be use on this inserted value. So, *how to insert only the value of 1 cell*?
```
```
One obvious way would be to create five separate spreadsheets; then you wouldn't need the internal labels and each spreadsheet could contain just its one significant cell.
```
Alternatively:
o Copy the relevant cell in the spreadsheet.
```
o Paste it into the text document, but using Edit | Paste Special... (or right-click | Paste Special... or Ctrl+Shift+V) instead of ordinary Paste.
```o In the Paste Special dialogue, select "DDE link".

```
Something like this would also work for your earlier problem, in fact. The only difference is that with OLE you can edit the linked document from the target one, whereas with DDE you cannot. In this case, it would mean you could edit the spreadsheet contents from within the text document. But you wouldn't want to do that in these scenarios.
```
I trust this helps.

Brian Barker

--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted
```