Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Segregating Numbers According to Their Sign.

# Segregating Numbers According to Their Sign

Written by Allen Wyatt (last updated December 26, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365

Are you working with a large set of data consisting of mixed values, some negative and some positive, that you want to separate into columns based on their sign? There are a few ways this can be approached. One method is simply to use a formula in the columns to the right of the mixed column. For instance, if the mixed column is in column A, then you could place the following formula in the cells of column B:

```=IF(A2>0,A2,0)
```

This results in column B only containing values that are greater than zero. In column C you could then use this formula:

```=IF(A2<0,A2,0)
```

This column would only contain values less than zero. The result is two new columns (B and C) that are the same length as the original column. Column B is essentially the same as column A, except that negative values are replaced by zero, while column C replaces positive values with zero.

If you want to end up with columns that only contain negative or positive values (no zeroes), then you can use the filtering capabilities of Excel. Assuming the mixed values are in column A, follow these steps:

1. If you have a column heading in cell A1, copy it to cell E1.
2. In cell E2, place the formula >0.
3. Select any cell in the mixed values of column A.
4. Display the Data tab of the ribbon.
5. Click Advanced in the Sort & Filter group. Excel displays the Advanced Filter dialog box. The List Range should already be filled in, representing the range of mixed values in Column A. (See Figure 1.)
6. Figure 1. The Advanced Filter dialog box.

7. Make sure the Copy to Another Location radio button is selected.
8. Select the Criteria Range box and then use the mouse to select cells E1:E2. This tells Excel that you only want cells in the original range that are greater than zero.
9. Select the Copy To box and click once in cell B1.
10. Click on OK. Column B now contains cells that are greater than zero.
11. In cell E2, place the formula <0.
12. Again, display the Data tab of the ribbon.
13. Click again on the Advanced tool in the Sort & Filter group. Excel displays the Advanced Filter dialog box. The settings in the dialog box should be the same as the last time you used them.
14. Select everything in the Copy To box, and then click once in cell C1.
15. Click on OK. Column C now contains cells that are less than zero.

You now have the desired two columns of positive and negative values. You can also delete the cells at E1:E2 if you desire.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9601) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Segregating Numbers According to Their Sign.

##### 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

Using AutoCorrect to Start Macros

As you are typing, AutoCorrect provides a "check" that what you are entering doesn't match some pre-defined error ...

Discover More

Disabling Printing

Don't want your worksheets to be printed out? You can make it a bit harder to get a printout by applying the techniques ...

Discover More

Setting Cell Width and Height Using the Keyboard

Hate to take your hands off the keyboard? Here are a couple of ways you can reject the mouse and still adjust the height ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

##### More ExcelTips (ribbon)

Calculating an IRR with Varying Interest Rates

You might wonder how you can calculate an IRR (internal rate of return) when the person repaying the loan pays different ...

Discover More

Filtering to a Standard Deviation

When you are working with large data sets, you may want to filter the information in those data sets according to various ...

Discover More

Entering Formulas in Excel

The primary way you signify that you are entering a formula is to start a cell entry with an equal sign. The equal sign ...

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}] (all 7 characters, in the sequence shown) 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 eight minus 0?

2024-01-09 16:10:28

J. Woolley

The Tip wants to extract all positive numbers from A2:A158 into column B and all negative numbers from A2:A158 into column C, with headings in row 1.
If you have Excel 2019 or newer with support for dynamic arrays, put this formula in cell B2
=FILTER(A2:A158,A2:A158>0)
and this formula in cell C2
=FILTER(A2:A159,A2:A159<0)
If you have an older version of Excel, you are missing out on a lot of capability.

2024-01-09 03:07:10

Thomas Papavasiliou

As a preliminary step. fill a column with a series of numbers (key column).
Sort the column to segregate.
Move all the negative cells to the first to the right, empty column.
Sort to the key column.

##### 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.

##### Subscribe

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