Function Problems

How to Compare Excel Values by Relative Size or Ratio

Emma BrownEmma Brown Oct 21, 2026 869 views

Question details

The user needs a method to compare two values in Excel by calculating their relative size or ratio, properly handling negative numbers and preventing division-by-zero errors.

How to Compare Excel Values by Relative Size or Ratio
Product
Microsoft Excel
Device & OS
not provided
Scenario
Calculating relative proportional differences or ratios between data points (including negative and zero values) to analyze magnitude differences or prepare data for bar charts.
Observed behavior
Simple subtraction does not accurately reflect proportional differences. Additionally, complex ratio formulas may display as plain text instead of calculating, and dividing by zero returns an error.
Before you start

Before applying these formulas, select your target cells, right-click to choose 'Format Cells', and ensure they are set to 'General' or 'Number'. If set to 'Text', Excel will display the formula itself instead of the calculated result.

Solution 1Recommended

Calculate Relative Ratio Using MAX, MIN, and ABS Functions

Use this comprehensive formula to calculate the magnitude ratio between two values regardless of their sign, while preventing division-by-zero errors.

To find out how many times larger one value is than another while ignoring positive/negative signs, you can divide the maximum absolute value by the minimum absolute value. Wrapping the formula in IFERROR ensures that if the denominator is zero, the formula defaults to a specified value (like 1) instead of showing an error.

1
Select the output cell

Click on the blank cell where you want the relative ratio to be displayed.

2
Enter the base comparison formula

Type the formula =MAX(ABS(B3),ABS(B4))/MIN(ABS(B3),ABS(B4)) assuming your values are in cells B3 and B4.

3
Add error handling for zero values

To prevent a #DIV/0! error when the minimum value is zero, wrap the formula in an IFERROR function by changing it to: =IFERROR(MAX(ABS(B3),ABS(B4))/MIN(ABS(B3),ABS(B4)), 1)

4
Calculate the result

Press Enter to execute the formula. If you are using an older version of Excel, you may need to press Ctrl+Shift+Enter to evaluate it as an array formula.

Calculate Relative Ratio Using MAX, MIN, and ABS Functions
Dealing with formula text display: If the formula displays as text after pressing Enter, change the cell format to General, double-click the cell to enter edit mode, and press Enter again.

Easily Calculate Data Ratios in WPS Spreadsheet

WPS Spreadsheet provides robust support for all standard data analysis functions, including MAX, MIN, ABS, and IFERROR. You can calculate complex ratios, seamlessly handle negative numbers, and instantly convert your results into clear, professional bar charts without any lag.

  1. 1. Open your data in WPS Spreadsheet: Launch WPS Office and open your workbook containing the values you want to compare.
  2. 2. Apply the comparison formula: Select an empty cell and input the formula =IFERROR(MAX(ABS(B3),ABS(B4))/MIN(ABS(B3),ABS(B4)), 1) to calculate the relative ratio.
  3. 3. Drag to fill: Click the small square at the bottom-right corner of the selected cell and drag it down to apply the ratio formula to the rest of your data set.
  4. 4. Insert a bar chart: Select the resulting data, navigate to the 'Insert' tab on the top ribbon, and click 'Chart' to choose a Bar Chart for immediate visualization.
Fully compatible with Microsoft Excel formulas, functions, and formatting.Quickly process complex calculations and array formulas with high performance.Built-in charting tools to instantly visualize ratio comparisons as bar charts.Free and lightweight alternative for comprehensive data analysis.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my Excel formula display as text instead of a calculated result?

This happens when the cell is formatted as 'Text' before you enter the formula. To fix it, right-click the cell, select 'Format Cells', choose 'General' or 'Number', click OK, then double-click the cell and press Enter to recalculate.

What does the '1' mean at the end of the IFERROR formula?

The '1' acts as a fallback value. If the formula encounters an error (such as trying to divide by zero when the minimum value is zero), the IFERROR function intercepts the error and returns 1 instead, representing a 1:1 ratio or baseline.

Why does the web version of Excel reject my comma-separated formula?

Depending on your regional settings or specific web version constraints, Excel may expect a semicolon instead of a comma to separate arguments, or it may struggle with arrays of non-contiguous cells. Using a continuous range like ABS(B3:B4) often circumvents this parsing issue.

How do the ABS and MAX/MIN functions work together for ratios?

The ABS function converts all numbers to positive values (magnitudes). The MAX function then finds the larger of these magnitudes, and the MIN function finds the smaller. Dividing the MAX by the MIN gives you a true multiple of how many times larger one magnitude is than the other, regardless of their original positive or negative signs.