logo
search
Formula Errors

How to Use Excel IF and AND Formula for Values Between 5 and 50

Maira MehtabMaira Mehtab Sep 22, 2026 868 views

Question details

The user needs to calculate 9% of a cell's value only if that value is strictly greater than 5 and strictly less than 50 using Excel functions.

Product
Excel
Device & OS
not provided
Scenario
Calculating a specific percentage for numbers that fall within a defined numerical range while accounting for regional formatting differences.
Observed behavior
The user requires the correct syntax to apply the IF and AND functions together, handling the distinction between commas and semicolons based on regional settings.
Before you start

Check your computer's regional settings to determine whether your version of Excel uses commas or semicolons to separate formula arguments.

Solution 1Recommended

Use Comma Separators for Standard US Regional Settings

Apply this formula if your system uses decimal points and comma separators for arguments.

In standard US and UK regional settings, Excel uses a comma (,) to separate arguments in a formula and a period (.) for decimal values. The AND function checks if the value meets both conditions, and the IF function applies the 9% calculation if true.

1
Select the Destination Cell

Click on the cell where you want the calculated result to appear.

2
Enter the Formula

Type =IF(AND(A2>5,A2<50),A2*0.09,"") into the formula bar, assuming your source value is in cell A2.

3
Apply the Calculation

Press Enter to apply the formula. If the value is outside the 5 to 50 range, the cell will remain blank.

Tip: You can drag the fill handle at the bottom-right corner of the cell to apply this formula to an entire column.
Efficient Spreadsheet Tool

Calculate Complex Formulas Easily with WPS Spreadsheet

WPS Spreadsheet fully supports standard Excel formulas, including nested IF and AND functions. You can seamlessly calculate ranges, manage data, and format results with high precision while avoiding regional syntax errors.

  1. 1. Open WPS Spreadsheet: Launch WPS Office and open your data workbook.
  2. 2. Select the Target Cell: Click the cell where you want to output the calculation.
  3. 3. Enter the Formula: Type the IF and AND formula and press Enter to instantly see the result.
Fully compatible with Microsoft Excel formulas and .xlsx file formats.Built-in formula prompts and syntax hints to help prevent typing errors.Lightweight, fast, and completely free to use for daily calculations.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my IF and AND formula return a syntax error?

This usually happens due to incorrect regional separators. Check if your system requires semicolons (;) instead of commas (,) between formula arguments.

How can I return a zero instead of a blank cell if the condition isn't met?

Replace the empty quotes ("") at the end of the formula with a zero. For example, using US settings: =IF(AND(A2>5,A2<50),A2*0.09,0).

Can I use this formula to include the numbers 5 and 50 in the calculation?

Yes, to include 5 and 50 exactly, change the greater than and less than operators to greater than or equal to (>=) and less than or equal to (<=). The formula becomes =IF(AND(A2>=5,A2<=50),A2*0.09,"").