Function Problems

How to Use Nested IF to Assign Company Size Categories in Excel

Khadija KhanKhadija Khan Nov 11, 2026 868 views

Question details

The user needs to write a formula using nested IF conditions to classify a numeric market cap value into a specific text category.

How to Use Nested IF to Assign Company Size Categories in Excel
Product
Excel
Device & OS
not provided
Scenario
Categorizing financial data by assigning labels (Micro Cap, Small Cap, Mid Cap, Large Cap, Mega Cap) based on numeric thresholds in a cell.
Observed behavior
The user wants to correctly order the logical tests to avoid invalid comparisons and ensure the correct category is returned.
Before you start

Ensure your market capitalization data is in a consistent numeric format (e.g., billions) before applying the nested IF formula, and verify the exact upper limit values for each tier.

Solution 1Recommended

Write an Ascending Nested IF Formula

Use a sequentially ordered nested IF statement to evaluate the value against the upper limit of each category from smallest to largest.

When using nested IF functions for value ranges, evaluate conditions in strict ascending order. This prevents logical errors, because Excel stops evaluating the formula as soon as it encounters the first TRUE condition.

To prevent blank cells from being incorrectly categorized as a small number (like Micro Cap), it is best practice to wrap the formula in an ISBLANK check.

1
Select the target cell

Click on the cell where you want the company size category text to appear.

2
Input the nested IF formula

Type the formula: =IF(ISBLANK(B5),"",IF(B5<=0.3,"Micro Cap",IF(B5<=2,"Small Cap",IF(B5<=10,"Mid Cap",IF(B5<=200,"Large Cap","Mega Cap")))))

3
Apply the formula

Press Enter to execute the formula. The cell will now display the correct category based on the value in B5.

4
Copy the formula to other cells

Click the small square at the bottom-right corner of the cell and drag it down to apply the categorization to the rest of your dataset.

Write an Ascending Nested IF Formula
Absolute vs Relative References: If you are copying the formula across rows, use a relative reference like B5. If the reference value is fixed in a specific cell for all calculations, use an absolute reference like B$5 or $B$5.
Master Formulas with WPS Spreadsheet

Easily Categorize Data Using WPS Spreadsheet

WPS Spreadsheet provides full support for complex logical functions like IF and IFS. You can easily categorize financial data, build automated models, and handle large datasets seamlessly without worrying about syntax limitations.

  1. 1. Open your dataset: Launch WPS Spreadsheet and open the workbook containing your company data.
  2. 2. Enter the formula: Click on the target cell, navigate to the Formula Bar, and input your nested IF or IFS formula.
  3. 3. Auto-fill your table: Press Enter, then double-click the fill handle to instantly categorize thousands of rows in seconds.
100% compatibility with Microsoft Excel formulas, including IF, IFS, and VLOOKUP.Built-in formula assistance and syntax highlighting to prevent logical errors.Lightweight software that processes large financial datasets quickly.Free to download and use with an intuitive, tabbed interface.
microsoft office alternative - wps office

Frequently Asked Questions

Why is my nested IF formula returning the wrong category?

This usually happens if the conditions are not in the correct ascending or descending order. Excel evaluates IF statements from left to right and stops at the first TRUE condition. Always test from smallest to largest (using <=) or largest to smallest (using >=).

How do I handle blank cells in a nested IF formula?

Wrap your main logic with a check for empty cells using the ISBLANK function. For example, starting your formula with =IF(ISBLANK(B5),"", ...) ensures that blank cells return an empty string instead of being treated as zero and incorrectly categorized as a small number.

Can I use VLOOKUP instead of a nested IF for categories?

Yes. For many categories, an approximate match VLOOKUP (setting the last argument to TRUE) is often cleaner than a long nested IF. You just need to set up a small reference table containing the lower bound of each tier and its corresponding label.

What is the maximum number of nested IFs allowed in Excel?

In modern versions of Excel and WPS Spreadsheet, you can nest up to 64 IF functions. However, if you are using more than 5 to 7 nested IFs, it is highly recommended to use the IFS function or a VLOOKUP reference table for better readability and easier maintenance.