Search

Filling cells with random numbers in libreoffice

While working with data in a spread sheet, we might have the need of filling up certain cells with random numbers with in a given range. We might enter these numbers ourselves if only a few are required, but if a large number of random numbers are needed then it will be tiresome and time consuming to do ti manually.

Libreoffice provides a shortcut to fill the cells with random numbers of what ever range we need. To fill the cells with random numbers, follow the procedure below.

Open libreoffice calculator/spreadsheet and select the range of cells in which random numbers have to be filled.

 photo random_select_range.png

Now click on Edit->fill->random numbers

 photo random_edit_menu.png

It will prompt a menu as shown below.

 photo random_number_gen.png

In the menu

Cell range: Is the range of cells that has been selected for filling with random numbers
Distribution: In case we are specific about the distribution of random numbers we can select one of the distributions. If we want only integers we can select Uniform integers
Seed: All random number generators us a seed value to generate random numbers, if we are specific about certain seed we can specify the same by selecting the check box and entering the seed value. else we can leave the default value.
Maximum and minimum: The range between which we want the random numbers to lie.

Afte entering the values as we need click on ok, and the range selected will be filled with the random numbers of hte given range.

 photo random_decimal_truncated.png

In case we want the random number to be in decimal, by default the random number generator will generate numbers with 8 decimal places.

 photo random_number_generated.png

If we do not need such high precision, we can truncate the value to one or two decimal places by right clicking on the cells and selecting format cells.

 photo random_format_cells.png

Select the numbers tab

 photo random_decimal.png

Select category as number and then choose the number of decimal places required and click on ok.

 photo random_2_decimal.png


libreoffice paste only numbers not formula

While working with libreoffice spread sheets, we often use formulas to update various fields. For example we might have a column having the marks scored by students of a class in various subjects as shown below.

 photo average_sheet.png

We can use the formula average to find the average marks scored by the class as shown below.

 photo average_formula.png

Now if we want to copy the averages from this sheet to another sheet a simple copy paste will not work. A simple copy paste will result in the pasted value being as below.

 photo normal_paste.png

This is because when we do a simple copy paste we care copying the fomula not the value that has bee derived from the formula. To paste the value alone, ignoring the actual formula, in the new sheet click on Eidt-> paste special

 photo edit_paste_special.png

A menu as shown below will be displayed.

 photo paste_special_menu.png

From this menu select what ever that needs to be pasted.Uncheck the paste all option and select that we need to paste numbers and text and remove the check next to the fomula option. Now click Ok and we will see that only the numbers of the average value will get pasted as shown below.

 photo only_numbers_pasted.png