Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Segregating Numbers According to Their Sign.

Segregating Numbers According to Their Sign

Written by Allen Wyatt (last updated January 14, 2023)
This tip applies to Excel 97, 2000, 2002, and 2003


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 several 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. Choose Filter from the Data menu, then choose Advanced Filter from the resulting submenu. 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.)
  5. Figure 1. The Advanced Filter dialog box.

  6. Make sure the Copy to Another Location radio button is selected.
  7. 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.
  8. Select the Copy To box and click once in cell B1.
  9. Click on OK. Column B now contains cells that are greater than zero.
  10. In cell E2, place the formula <0.
  11. Again choose Filter from the Data menu, then choose Advanced Filter from the resulting submenu. Excel displays the Advanced Filter dialog box. The settings in the dialog box should be the same as the last time you used them.
  12. Select everything in the Copy To box, and then click once in cell C1.
  13. 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 (3198) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) 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

Counting Filtered Rows

The filtering capabilities of Excel are indispensable when working with large sets of data. When you create a filtered ...

Discover More

Creating a Copy without Formulas

Excel makes copying worksheets (duplicating them) rather easy. However, you may want a worksheet copy that differs from ...

Discover More

Changing Character Spacing

Excel allows you to adjust spacing between cell walls and the contents of those cells. It does not, however, allow you to ...

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 (menu)

Creating an Amortization Schedule

An amortization schedule is a report that shows how the outstanding balance on a loan changes with payments made over ...

Discover More

Condensing Sequential Values to a Single Row

If you have a bunch of ZIP Codes or part numbers in a list, you may want to "condense" the list so that sequential series ...

Discover More

Summing Only the Largest Portion of a Range

Given a range of cells, you may at some time want to calculate the sum of only the largest values in that range. Here is ...

Discover More
Subscribe

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

View most recent newsletter.

Comments

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 2 + 2?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

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

Newest Tips
Subscribe

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

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.