HomeGoogle DocsSpreadsheetHow to Generate Odd or Even Random Numbers in Google Sheets

How to Generate Odd or Even Random Numbers in Google Sheets

Published on

To generate a single or a set of random odd or even numbers, at present, there is no specific function in Docs Sheets. Then how to generate odd or even random numbers in Google Sheets?

I am going to use a very simple combination formula for this purpose. It’s the combination of RANDBETWEEN, ROW, ODD/EVEN.

In the below example section, I will explain how to code this combination formula flawlessly.

Formula to Generate Odd or Even Random Numbers

Please note the following.

Once you have generated the required numbers, please copy that numbers and paste as values – Ctrl+Shift+v in Windows, and ⌘ + Shift + v in Mac – on another range. As the RANDBETWEEN involved in the combo is volatile.

As already stated above, I am going to use a combo formula. What else? The combo formula is an array formula which can generate a set of numbers!

Let’s start with random odd numbers.

Random Odd Numbers

To generate a random odd number between 1 and 999 (both the number inclusive), you can use this combo.

=ODD(RANDBETWEEN(1,999))

To return a set of (here 4) odd numbers between 1 and 999, modify the above formula as below.

=ArrayFormula(ODD(RANDBETWEEN({1;1;1;1},999)))

Must Check: Google Sheets Array Formula Example and Usage.

In the above formulas, the low end of the random odd number range is 1 and the high end of the random odd number range is 999.

You can change this range. But when you generate a large number odd random numbers, keep this range as wide as possible like 1 to 99999. This can avoid duplicates.

Also, in such case, the just above formula won’t be useful. Suppose you want to generate 20 odd random numbers. You must change the above low range array {1;1;1;1} manually. See that formula.

=ArrayFormula(ODD(RANDBETWEEN({1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1},1000)))

To avoid this ‘problem’, here you can replace the low range array with a ROW formula as below.

=ArrayFormula(ODD(RANDBETWEEN(row(A1:A20)^1,1000)))
Generate Odd Random Numbers in Google Sheets

Random Even Numbers

In the above formula example, I have explained how to generate a set of random odd numbers in Google Sheets. Do you want random even numbers?

Replace the function ODD in the above formula with EVEN. That’s the only change required.

=ArrayFormula(EVEN(RANDBETWEEN(row(A1:A20)^1,1000)))
Generate EVEN Random Numbers in Google Sheets

When you use the above formula without ODD or EVEN, it generates random numbers with the number of times specified by the row function. The ODD/EVEN function makes the difference.

I mean, the ODD function rounds up the even random numbers to odd and on the contrary, the EVEN function rounds up the odd random numbers to even.

That’s all. Hope you have enjoyed this post.

Additional Resources:

  1. How to Pick a Random Name from a Long List in Google Sheets.
  2. How to Shuffle Rows in Google Sheets Without Plugin.
  3. Google Sheets: Macro-Based Random Name Picker.
  4. How to Randomly Select N Numbers from a Column in Google Sheets.
  5. How to Randomly Extract a Certain Percentage of the Rows in Google Sheets.
Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Running Total By Month in Excel

This tutorial demonstrates how to calculate the running total by month in a range...

SORT and SORTBY – Excel Vs Google Sheets

While Excel offers the SORT and SORTBY functions for sorting a table, Google Sheets...

Get Top N Values Using Excel’s FILTER Function

When using the FILTER function in Excel to extract the top N values, it's...

More like this

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.