How to Use ODD Function in Excel (3 Examples)

There are lots of functions in Excel to perform specific tasks. One of them is this ODD function. We use this function to get odd values. In this article, we will discuss this Excel ODD function and examples with proper explanations.


Download Practice Workbook

Download this practice workbook to exercise while you are reading this article.


Introduction to ODD Function

The ODD function always returns an odd number. In the case of positive numbers, it rounds up that number to the nearest odd integer. On the other hand, for negative numbers, it rounds down that number to the nearest odd integer.

Syntax:

=ODD(number)

Arguments:

ARGUMENT REQUIRED/OPTIONAL EXPLANATION
number REQUIRED It is the number for which we want the nearest odd integer.

Return:

In return, we will always get an odd integer.

Available in:

Microsoft Excel 365, Microsoft Excel 365 for Mac, Excel for the Web, Excel 2021, Excel 2021 for Mac, Excel 2019, Excel 2019 for Mac, Excel 2016, Excel 2016 for Mac, Excel 2013, Excel 2010, Excel 2007, Excel for Mac 2011, Excel Starter 2010.


3 Suitable Examples of ODD Function in Excel

In this section, we will discuss some examples to help understand the use of the ODD function. For details, have a look at the below section.


Example 1: Use of ODD Function with Integers

In this example, we will use the ODD function with integer values.

1.1 ODD Function with Positive Integers

This will illustrate the use of the ODD function on positive integer values. We will consider the following dataset, which contains only positive values.

We can see the dataset contains both odd and even positive integers.

📌 Steps:

  • Now, apply the following formula to Cell C5.
=ODD(B5)
  • Also, extend this formula to the last cell.

ODD Function with Positive Integers

We can see all the numbers in the Result column are converted to odd numbers.

  • Again, look at the dataset.

Cell B6 consists of an odd number, and the ODD function does not make any change in the output on Cell C6. It means the ODD function does not have any effect on odd numbers.

1.2. ODD Function with Negative Integers

In this example, we will use negative integers as the input values.

📌 Steps:

  • We can see there are negative integers in the dataset.
  • Apply the following formula to Cell C5 and extend this to Cell C12.
=ODD(B5)

ODD Function with Negative Integers

  • Look at Row 6.

Cell B6 contains an odd value. Also, cell C6 contains another odd value. It means the ODD function does not perform any operation on odd values.

Read More: How to Verify Odd and Even Using IF Function in Excel


Example 2: Utilize ODD Function with Fraction Numbers

In this example, we will utilize the ODD function to get odds from the fraction values. Faction values contain at least one decimal point. But in the return, the decimal section will remove and get odd integers only.

2.1 Positive Fraction Numbers

📌 Steps:

  • Look at the dataset.

All the inputs are positive fractions.

  • Put the following formula on Cell C5.
  • Expand this formula till Cell C12 using the Fill Handle feature.
=ODD(B5)

ODD Function with Positive fraction numbers We get odd returns against the positive fractions.

  • Now, look at Rows 5 and 6.

Cells B5 and B6 contain fractions, and their values are not the same. But the output of both is the same. Here, the ODD function rounds up the positive inputs and returns the neatest odd integers. For this, we get the same output for different inputs.

2.2 Negative Fraction Numbers

In this example, we will consider the negative fraction value in the dataset.

📌 Steps:

  • Apply the formula on Cell C5 based on the ODD function.
=ODD(B5)

ODD Function with Negative fraction numbers In the return, we get the nearest odd integer.

  • Look at Rows 5 and 6.

For negative fractions, the ODD function rounds down the fractions and returns the nearest odd integer with a negative sign.

Read More: How to Fill Odd Numbers in Excel (5 Suitable Examples)


Example 3: Use ODD Function in Excel VBA

In this section, we will use the ODD function in the VBA macro.

📌 Steps:

  • First, we inserted some numbers in the dataset.
  • Then, go to the Sheet Name section at the bottom of the sheet.
  • Press the right button of the mouse.
  • Choose the View Code option from the menu.

  • The VBA Applications window appears.
  • Choose the Module option from the Insert tab.

  • Now, insert the following VBA code on this window.
Sub odd_function()
Dim Input_number, Output_Number As Double
Set Input_number = Application.InputBox("Select Cell", "Cell", Type:=8)
Output_Number = Application.WorksheetFunction.Odd(Input_number)
MsgBox (Output_Number)
End Sub

ODD Function in Excel VBA

  • Run the code by pressing the F5 button.
  • A dialog box will appear to choose cells from the dataset.
  • Select any cell and press the OK button.

  • Finally, a message box appears.

This shows the result after applying the ODD function.

Read More: How to Check If a Number Is Odd in Excel (3 Easy Ways)


Find and Count Odd or Even in Excel

Here, we will mark the odd or even numbers and count them using the IF and COUNTIF functions in Excel.

📌 Steps:

  • We have a list of numbers. Some of them are odd, some even, and the rest are not any of them will mark as N/A.

  • Apply the following formula on Cell C5 based on the nested IF function.
  • Also, expand the formula till Cell C12.
=IF($B5=ODD($B5),"Odd",(IF($B5=EVEN($B5),"Even","N/A")))

Find odd or even in Excel

We can see the numbers have been marked.

  • Now, use formulas based on the COUNTIF function on Cells E5 and F5.

For Cell E5:

=COUNTIF($C$5:$C$12,E4)

For Cell F5:

=COUNTIF($C$5:$C$12,F4)

Count odd or even in Excel

We get the total number of odd and even numbers separately.

Read More: Excel Formula for Finding Odd or Even Numbers


Excel Odd Even Conditional Formatting

Here, we will highlight the cells containing odd and even numbers with different colors. We will use ISEVEN and ISODD functions in the conditional formatting.

📌 Steps:

  • First, choose the dataset.
  • Then, go to the Conditional Formatting section.
  • Choose the New Rule option from the list.

  • Edit Formatting Rule window appears.
  • Choose to Use a formula to determine which cells to format as the rule type.
  • Then, insert the following formula.
=ISODD(B5)
  • After that, click on the Format button.

  • Select the Fill tab.
  • Then choose the desired background color from the odd numbers.
  • Finally, press the OK button.

  • It returns us to the previous window.
  • We will have a look at the preview.

  • Again, press the OK button and look at the dataset.

Excel Odd Even with Conditional Formatting

We can see the cells containing odd values have been highlighted.

  • Similarly, we inserted another formula to highlight the even cells.
  • Here, we insert this formula.
=ISEVEN(B5) 

Formula to highlight odd or even with Excel Conditional formatting

  • We set a different background color from the format button.
  • Finally, press the OK button and look at the dataset again.

Cells containing odd and even values have been highlighted nicely.

We can also use the MOD function in this case.

For Odd:

=MOD(B5,2)=1

and For Even:

=MOD(B5,2)=0

Things to Remember

  • For any non-numeric value, the ODD function will return #VALUE!
  • For integers, it will not perform round up or down.

Conclusion

In this article, we discussed three examples of ODD function in Excel. We also explained how to highlight odd and even numbers in Excel with proper explanations. I hope this will satisfy your needs. Please have a look at our website, ExcelDemy, and give your suggestions in the comment box.


Related Articles

Alok Paul

Alok Paul

Hello, this is Alok. I am working as an Excel & VBA Content Developer at Exceldemy. I want to provide solutions to various Excel-based problems. I completed my study at East West University major in Telecommunications Engineering. I love traveling, reading books, playing cricket.

We will be happy to hear your thoughts

Leave a reply

5 Excel Tips
You Never Knew

Genius tips to help you unlock Excel's hidden features

FREE EMAIL BONUS

ExcelDemy
Logo