How to Generate Odd or Even Random Numbers in Google Sheets

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.

Compare Two Tables for Differences in Excel

To compare two tables with similar data for differences, you can use the XLOOKUP...

Calculate Weighted Average in Pivot Table in Google Sheets

You can calculate a weighted average in a Pivot Table using a custom formula...

Summarize Data and Keep the Last Record in Google Sheets

In Google Sheets, we can summarize data (like sum, average, min, max, count) using...

How to Retrieve the Last Record in Each Group in Excel

As part of data analysis, you may need to retrieve the last record from...

More like this

Calculate Weighted Average in Pivot Table in Google Sheets

You can calculate a weighted average in a Pivot Table using a custom formula...

Summarize Data and Keep the Last Record in Google Sheets

In Google Sheets, we can summarize data (like sum, average, min, max, count) using...

Filter Data with Multi-Select Drop-Downs in Google Sheets

If you've started using multi-select drop-downs in Google Sheets, you may encounter challenges when...

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.