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?
- Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
- More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words.
- Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum.
- Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns.
- Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Send Personalized Emails to Multiple Recipients in Bulk.
- Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
- More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.
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:
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 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:
2. In the Extract Text dialog, type .?? into the Text box, and click Add to add this criterion into the Extract list. See screenshot:
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:
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:
- How to remove leading zeros before decimal point in Excel?
- How to convert decimal hours/minutes to time format in Excel?
- How to convert decimal number to binary/octal/hex number or vice versa in Excel?
- How to generate random decimal/integer numbers in Excel?