A quick way to place numbers into a banding group?

TheWennerWoman

Board Regular
Joined
Aug 1, 2019
Messages
60
Is there a quick way, either via Excel or via VBA? I have two columns of data, column A contains the numbers 1 - 20000 in numerical order.

What I need in column B is to place them in a band of 50.......so numbers 1 to 50 in column A will have "1 to 50" in column B, numbers 51-100 in column A will have "51 to 100" in column B.

I started off with

Code:
=IF(A2<51,"1 to 50",IF(AND(A2>50,A2<101),"51 to 100",IF(AND(A2>100,A2<151),"101 to 150",IF(AND(A2>150,A2<201),"151 to 200",IF(AND(A2>200,A2<251),"201 to 250",IF(AND(A2>250,A2<301),"251 to 300",IF(AND(A2>300,A2<351),"301 to 350",IF(AND(A2>350,A2<401),"351 to 400",IF(AND(A2>400,A2<451),"401 to 450",IF(AND(A2>450,A2<501),"451 to 500",IF(AND(A2>500,A2<551),"501 to 550")))))))))))

but that's so time consuming to write plus I believe Excel has a limit on nested IF statements.

Any help appreciated and seasons greetings to you all.
 

Some videos you may like

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Watch MrExcel Video

Forum statistics

Threads
1,127,106
Messages
5,622,772
Members
415,927
Latest member
vedasinternational

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top