Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

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 120 handy functions, makes your jobs 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



Recommended Productivity Tools for Excel

Kutools for Excel Helps You Always Finish Work Ahead of Time, and Stand Out From Crowd

  • More than 300 powerful advanced features, designed for 1500 work scenarios, increasing productivity by 70%, give you more time to take care of family and enjoy life.
  • No longer need memorizing formulas and VBA codes, give your brain a rest from now on.
  • Become an Excel expert in 3 minutes, Complicated and repeated operations can be done in seconds, 
  • Reduce thousands of keyboard & mouse operations every day, say goodbye to occupational diseases now.
  • 110,000 highly effective people and 300+ world-renowned companies' choice.
  • 60-day full features free trial. 60-day money back guarantees. 2 years of free upgrade and support.

Brings Tabbed Browsing and Editing to Microsoft Office, Far More Powerful Than The Browser's Tabs

  • Office Tab is designed for Word, Excel, PowerPoint and Other Office Applications: 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!
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.