How to assign a value or category based on a number range in Excel?

his article is talking about assigning value or category related to a specified range in Excel. For example, if the given number is between 0 and 100, then assign value 5, if between 101 and 500, assign 10, and for range 501 to 1000, assign 15. Method in this article can help you get through it.

Assign a value or category based on a number range with formula


Assign a value or category based on a number range with formula

The following formulas can help you to assign a value or category based on a number range in Excel. Please do as follows.

1. Select a blank cell, enter the below formula into it and then press the Enter key.

=IF(AND(A2>=0, A2<= 100), 5,IF(AND(A2>=101, A2<=500), 10, IF(AND(A2>=501, A2<=1000),15, 0)))

Notes:

1. In the formula, A2>0, A2<=100, 5 means that If a given number is between 0 and 100, then assign value 5. And the others are the same meaning. Please change them to you need.
2. If the given number is not within the specified range, a 0 will be displayed.
3. This formula also can help to assign the data with text format, please apply the below formula:
=IF(AND(A2>=0, A2<= 100), "Five",IF(AND(A2>=101, A2<=500),"Ten", IF(AND(A2>=501, A2<=1000),"Fifteen", "Zero")))

2. Keep selecting the result cell, drag the Fill Handle down to get all values of given numbers based on ranges. See screenshot:

Tips: The following formula can help to assign specific category based on cell values:
1. Create a table with all number ranges and assigned categories listed inside as below screenshot shown.

2. Select a blank cell adjacent to the given number, enter formula into the Formula Bar, and then press the Enter key. See screenshot:

=VLOOKUP(A13,$A$2:$C$4,3)

Note: In the formula, A13 is the cell contains the given number you will assign category based on, $A$2:$C$4 is the table range you created in step 1, and number 3 is the column number with the assigned value in the table.
3. Then drag the Fill Handle down to get all results.


Related articles:


The Best Office Productivity Tools

Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, 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!
officetab bottom
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.
  • To post as a guest, your comment is unpublished.
    Lapema · 3 months ago
    i wanted to do a 10 grade with this system everything fine until i reach 5th grade then its just doesnt work

  • To post as a guest, your comment is unpublished.
    Mindyleigh · 9 months ago
    How would this work if the numbers were negative? For example, if the given number is between -100 and 0, then assign value 1.
  • To post as a guest, your comment is unpublished.
    Cow fram · 1 years ago
    I couldnt make this work