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.
Excel Productivity Tools
Office Tab: Bring powerful tabs to Office (include Excel), just like Chrome, Safari, Firefox and Internet Explorer. Save you half the time, and reduce thousands of mouse clicks for you. 30-day Unlimited Free Trial
Kutools for Excel: Save 70% of your time and solve 80% Excel problems for you. 300+ advanced features designed for 1500+ work scenario, make Excel much easy and increase productivity immediately. 60-day Unlimited Free Trial
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 formula =IF(AND(A2>=0, A2<= 100), 5,IF(AND(A2>=101, A2<=500), 10, IF(AND(A2>=501, A2<=1000),15, 0))) into the formula bar, and then press the Enter key.
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 this: =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:
The following formula also can help you to assign specific category based on cell values, please do as follows:
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 =VLOOKUP(A13,$A$2:$C$4,3) into the Formula Bar, and then press the Enter key. See screenshot:
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.
- How to move entire row to another sheet based on cell value in Excel?
- How to calculate average in a column based on criteria in another column in Excel?
- How to automatically send email based on cell value in Excel?
- How to sum values based on selection of drop-down list in Excel?