# Conditional IF statements

#### petiteshiraz

##### Board Regular
I need to create a formula that categorizes the data from column A into one of 7 categories. For example, if cell A1 is 468, I need a formula to decide which of these categories it falls into:

1. 730 or more
2. 366 to 729
3. 180 to 365
4. 90 to 179
5. 60 to 89
6. 31 to 59
7. 30 or less

How can I do this?

### Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

#### AliGW

##### Banned
Try this:

=LOOKUP(A1,{0,31,60,90,180,366,730},{7,6,5,4,3,2,1})

#### Marcílio_Lobão

##### Well-known Member
petiteshiraz, Good afternoon.

Using a IF Function as you desire,

Try to use:

=IF(A1>=730, 1, IF(A1>=366, 2, IF(A1>=180, 3, IF(A1>=90, 4, IF(A1>=60, 5, IF(A1>=31, 6, 7 ))))))

Is that what you want?
I hope it helps.

Last edited:

#### AliGW

##### Banned
The OP mentions IF in the thread title, but only "formula" in the post - I presume they want the most efficient way of doing it, which is why I have not offered a nested IF statement.

#### Marcílio_Lobão

##### Well-known Member
AliGW, Good afternoon.

I totally agree with you.

The use of the LOOKUP function in this case is much more efficient than the requested IF function.

The family of LOOKUP, VLOOKUP and HLOOKUP functions are spectacular.

Maybe I did not understand the user's request correctly.

Have a nice day!

Greetings from Brazil

Last edited:

Replies
8
Views
901
Replies
4
Views
950
Replies
5
Views
359
Replies
7
Views
290
Replies
2
Views
895

1,190,786
Messages
5,982,919
Members
439,807
Latest member
WXM86

### 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?

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