How to compare two numbers with decimal numbers in Excel?

Supposing there are two columns of decimal numbers, and you just want to compare two numbers in each row by the decimal numbers only as below screenshot shown. How can you quickly solve this job in Excel?
doc compare decimal only 10

Compare two decimal numbers with formula

Compare two decimal numbers with Extract Text


Compare two decimal numbers with formula

To compare only two decimal numbers between two numbers, you can apply following formulas as you need.

Select a blank cell next to the two numbers you want to compare, type this formula =IF((FLOOR(A1, 0.01)-FLOOR(B1, 0.01))=0,1,-1), press Enter key, and to drag fill handle down to compare two columns. In the calculated results, 1 indicates the two decimal numbers are the same, while -1 marks the two decimal numbers are different. See screenshot:

doc compare decimal only 1 shot arrow right doc compare decimal only 2

Note: In above formula, A1 and B1 are the two numbers you want to compare, 0.01 indicates to compare decimal numbers by two digits.

Tip: If you want to round the decimal firstly and then compare, you can use one of following two formulas.

In the formulas, 2 indicates to compare first two digits in decimal numbers, A1 and B1 are the numbers you want to compare.

=IF((ROUND(A1,2)-ROUND(B1,2))=0,1,-1)

=IF(ROUND(A1,2)=ROUND(B1,2),"ok","!!ERROR!!")


Compare two decimal numbers with Extract Text

If you just want to compare decimal numbers by the first two or first n digits, you can apply the Extract Text utility of Kutools for Excel to extract the decimal numbers you need first, and then use a simple formula to compare them.

Kutools for Excel, with more than 300 handy functions, makes your jobs more easier. 

After installing Kutools for Excel, please do as below:(Free Download Kutools for Excel Now!)

1. Select the two columns numbers you want to compare, and click Kutools > Text > Extract Text. See screenshot:
doc compare decimal only 3

2. In the Extract Text dialog, type .?? into the Text box, and click Add to add this criterion into the Extract list. See screenshot:

doc compare decimal only 4 shot arrow right doc compare decimal only 5

3. Only check the new criterion in the Extract list section, and click Ok. Then select a cell to place the extracted decimal numbers, and click OK to finish. See screenshot:
doc compare decimal only 6
doc compare decimal only 7

4. In the adjacent cell to the extracted numbers, type this formula =IF((D1-E1)=0,1,-1), type Enter key, and to drag fill handle down to the cells you need. In the results of calculations, 1 indicates the two numbers are the same, -1 shows the numbers are different. See screenshot:

doc compare decimal only 8 shot arrow right doc compare decimal only 9

Relative Articles


The Best Office Productivity Tools

Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.