if value is between x and y then ""

Benaii

New Member
Joined
Nov 9, 2015
Messages
1
Hello !

I am looking for an excel formula or VBA code for the following :

If value is between x and y , then "1", else if value is between y and z; then "2", else.....

So far I was actually using IF(A1<=E1;1;IF(AND(A1>=E2;A1<=E3);2;IF(AND(..........
So basically, lots of if(and()) imbricated.

This was working well until the point I actually had too many of them for excel...

So now I need to find a new formula. I guess my way of doing this originally was far from optimal but it worked.

Anyone knows of a better way? I guess in VBA lies the answer but I am not trained on it and dont know how to do it..

Thanks a lot in advance, hope this was clear.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Welcome to the board.

I'm thinking a lookup or match type of function should do the job.
But it's a little unclear what the relationsips between A1 and the values in column E.

Can you post some sample data, and expected results?

Also which version of XL are you using?
 
Upvote 0

Forum statistics

Threads
1,215,477
Messages
6,125,030
Members
449,205
Latest member
Eggy66

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
Back
Top