# Finding Odd Values Greater Than 50

by Allen Wyatt
(last updated May 22, 2017)

Amol has 1,000 values in an Excel worksheet, occupying 100 rows of 10 columns each. Each value in this range is an integer value between 0 and 99. Amol needs a way to count and display all the values which are odd and greater than 50.

There are a few ways you can go about counting and displaying, but it is important to understand that these are different tasks. Perhaps the best way to display those values that fit the criteria is to use conditional formatting. You can add a conditional formatting rule to each cell that will make bold or otherwise highlight the desired values. Follow these steps:

1. Select the cells that contain your data.
2. Display the Home tab of the ribbon.
3. Click the Conditional Formatting tool in the Styles group. Excel displays a palette of options related to conditional formatting.
4. Click New Rule. Excel displays the New Formatting Rule dialog box.
5. In the Select a Rule Type area at the top of the dialog box, choose Use a Formula To Determine Which Cells to Format. (See Figure 1.)
6. Figure 1. The New Formatting Rule dialog box.

7. In the formula box enter the formula =AND(MOD(A1,2),A1>50).
8. Click the Format button. Excel displays the Format Cells dialog box. (See Figure 2.)
9. Figure 2. The Format Cells dialog box.

10. Use the controls in the dialog box to modify the formatting, as desired.
11. Click OK to close the Format Cells dialog box.
12. Click OK to close the New Formatting Rule dialog box. The formatting is applied to the range of cells you selected in step 1.

If you prefer, you could also use the following formula in step 6:

```=AND(ISODD(A1),A1>50)
```

To get the count of cells that fit the criteria, you could use an array formula:

```=SUM(--((MOD(MyCells,2))*(MyCells>50)))
```

This formula assumes that the range of cells you want to analyze are named MyCells. Don't forget to enter the cell using Ctrl+Shift+Enter. If you don't want to use an array formula, you could use the following:

```=SUMPRODUCT(--(MOD(MyCells,2)*(MyCells>50)))
```

You could also use a macro to derive both the cells and the count. The following is a simple version of such a macro; it places the values of the cells matching the criteria into column M and then shows a count of how many cells there were:

```Sub SpecialCount()
Dim c As Range
Dim i As Integer

i = 0
For Each c In Range("A2:J101")
If c.Value > 50 And c.Value Mod 2 Then
i = i + 1
Range("L" & i).Value = c.Value
End If
Next c

MsgBox i & " values are odd and greater than 50", vbOKOnly
End Sub
```

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12597) applies to Microsoft Excel 2007, 2010, and 2013.

##### Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

##### MORE FROM ALLEN

Understanding and Using Bookmarks

Bookmarks are a great feature you can use to mark the location of text or to mark a position within a document. They can ...

Discover More

Maintaining the Active Cell

Move from one worksheet to another, and Excel selects whatever cell was last used in the worksheet you are selecting. If ...

Discover More

Understanding Monospace Fonts

Information in a worksheet needs to be displayed using fonts. If you understand the two different types of fonts ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

##### More ExcelTips (ribbon)

Summing Absolute Values

You can easily sum a series of values in Excel, but it is not so easy to sum the absolute values of each value in a ...

Discover More

Breaking Up Variable-Length Part Numbers

Part numbers can often be long, made up of other component elements. Breaking up part numbers into individual components ...

Discover More

Ignoring N/A Values in a Sum

You can use some of Excel's worksheet functions across a range or worksheets, but not all of them. One that has problems ...

Discover More
##### Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is six more than 8?

2013-04-23 10:41:05

Michael (micky) Avidan

Wim de Groot & Nigel,

Both of you are more than welcome.

Michael Avidan
“Microsoft®” MVP – Excel
ISRAEL

2013-04-23 05:21:15

Nigel

Thank you for the clarification of the double minus. That is a very useful tidbit, and well explained!

2013-04-23 05:12:50

Michael (micky) Avidan

... by the way - if somebody wants to be holier than the pope - he should write:

This is an Array Formula.
One should NOT type the curly braces.
To confirm - the "three key combination" must be used.
While holding down CTRL+SHIFT press ENTER instead of just pressing ENTER.

Michael Avidan
“Microsoft®” MVP – Excel
ISRAEL

2013-04-23 05:08:04

Michael (micky) Avidan

@ Wim de Groot,

I'm NOT responsible for what this site is explaining/suggesting NOR for correcting their TIPOs.

To my opinion - the sentence, you quoted, should read:

Don't forget to enter the FORMULA(!) [not the cell] using Ctrl+Shift+Enter.

Michael Avidan
“Microsoft®” MVP – Excel
ISRAEL

2013-04-22 05:46:35

Wim de Groot

@Mickel Avidan
=SUM(--((MOD(MyCells,2))*(MyCells>50)))
This formula assumes that the range of cells you want to analyze are named MyCells. Don't forget to enter the cell using Ctrl+Shift+Enter.

I just made an ajustment to that, so I thought, it is not necessary to repeat Ctrl+Shift+Enter.

Btw, thanks for explaining the use of "Double Minus" signs!

2013-04-21 21:23:55

rachel

I wonder if you could use COUNTIFS function for this?

2013-04-21 16:52:05

Juan

Thanks a lot, Michael Avisan, your explanations are very useful

2013-04-20 07:46:38

Michael (micky) Avidan

@Wim de Groot

You left out some very important information regarding the suggested formula by you

In this case, using SUM instead of SUMPRODUCT will enforce the formula to become an Array Formula - which should be confirm using the "three key combination".
While holding down CTRL+SHIFT pressing ENTER.

An Array formula can be identified, in the Formula Bar, if it is confined in a pair of curly braces.

Michael Avidan
“Microsoft®” MVP – Excel
ISRAEL

2013-04-20 07:39:56

Michael (micky) Avidan

Nigel,

In the proposed formula there is, absolutely, no need for the "Double Minus" signs.

The following formula will return the same result:
=SUMPRODUCT((MyCells>50)*MOD(MyCells,2))

The use of "Double Minus" signs (or the "N" function) comes handy when the multiplication result, of two or more ranges, ends up with {True;False;True;False;False;True} which cannot be summed (counting the TRUE results)

The first "Minus converts the {True;False;True;False;False;True} into {-1;0;-1;0;0;-1} and the second "Minus" converts it into: {1;0;1;0;0;1} – which can be easily summed.

Michael Avidan
“Microsoft®” MVP – Excel
ISRAEL

2013-04-20 07:29:39

Wim de Groot

I don't know the purpose of the --, but
=SUM(--((MOD(MyCells,2))*(MyCells>50)))

can be simplified into
=SUM(MOD(MyCells,2)*(MyCells>50))

2013-04-20 07:07:25

Martin Nicol

A good tip. Use of the AND function were interesting.
Thank you.

2013-04-20 05:36:22

Nigel

What is the -- in the formulae? I have not come across this before?

##### This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.