IF Function

NLCROSS

New Member
Joined
Dec 1, 2021
Messages
4
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hi, all - I have been banging my head on the desk over this one...it's gotta be so simple, right? Have searched online, and on Mr. Excel, but still can't get this right.

I need a formula in cell H2 that says "IF cell H2 is greater than 0 but less than 30 then show 0-30, H2 is greater than 31 but less than 60 then show 31-60, H2 is greater than 61 but less than 90 then show 61-90, H2 is greater than 91 but less than 120 then show 91-120, H2 is greater than 121 but less than 150 then show 121-150, H2 is greater than 151 but less than 180 then show 151-180

Thanks in advance!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hi & welcome to MrExcel.
Do you have a formula in H2?
 
Upvote 0
In that case you cannot do it with a formula. A cell can have either a value or a formula but not both.
However you could put a formula in another cell if that's ok?
 
Upvote 0
T202112a.xlsm
HIJK
1
217500-30
3151-1803131-60
4151-1806161-90
59191-120
6121121-150
7151151-180
8181>= 181
9
1b
Cell Formulas
RangeFormula
H3H3=LOOKUP(H2,J2:K8)
H4H4=LOOKUP(H2,{0,"0-30";31,"31-60";61,"61-90";91,"91-120";121,"121-150";151,"151-180";181,">= 181"})
 
Upvote 0
In that case you cannot do it with a formula. A cell can have either a value or a formula but not both.
However you could put a formula in another cell if that's ok?
Apologies' I want the 0-30, 31-60 etc to appear next to the column.

1638371859178.png
 
Upvote 0
In that case I would recommend using a lookup table as shown by Dave in post#5
 
Upvote 0
N.B. You can copy the post to a clean sheet.
Click on the icon below the f(x) in the heading below and paste the information into your sheet.
With Name Manager, I named the array (see J2).
New name aL Value {0,"0-30";31,"31-60";61,"61-90";91,"91-120";121,"121-150";151,"151-180";181,">= 181"}

T202112a.xlsm
HIJKLM
1
2175151-180151-180151-18000-30
3250-300-300-303131-60
47561-9061-9061-906161-90
5125121-150121-150121-1509191-120
6250>= 181>= 181>= 181121121-150
7151151-180
8181>= 181
9
1b
Cell Formulas
RangeFormula
I2:I6I2=LOOKUP(H2,$L$2:$M$8)
J2:J6J2=LOOKUP(H2,{0,"0-30";31,"31-60";61,"61-90";91,"91-120";121,"121-150";151,"151-180";181,">= 181"})
K2:K6K2=LOOKUP(H2,aL)
 
Last edited:
Upvote 0
Solution

Forum statistics

Threads
1,215,054
Messages
6,122,895
Members
449,097
Latest member
dbomb1414

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