IF cell between values, then...

BravoBravoAu

Board Regular
Joined
Nov 8, 2011
Messages
63
Office Version
  1. 2016
Platform
  1. Windows
Hi guys,

Hopefully another quick and easy formatting (or conditional formatting) solution here, but I'm stuck.

I have a pretty sizable workbook, with one section focusing on hours worked for a particular task. What I'd like to be able to do is, depending on how many hours are recorded as being worked in column A, then an X is placed in the range (less than 2 hours / 2-3 hours / 3-6 hours / more than 6 hours).

I envisage cell B2 would need to be formulated IF A2 is less than 2 hours, then "X"; C2 IF A2 is 2-3, then "X"; D2 if A2 is 3-6, then "X"; E2 IF A2 is more than 6 then "X". BUT, I can't seem to get any to work as intended. Please help?

ABCDE
1Hours worked0-22-33-66+
21X
35 X
49 X
52 X
63 X
76
87
95
104
112

<tbody>
</tbody><colgroup><col><col><col span="4"></colgroup>
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
I've solved it.

I put an additional column in to B to consider a nested IF formula (So...=IF(A2<2,"A",IF(A2<3,"B",IF(A2<6,"C","D")))).

C2 has the formula =IF(B2="A","X","").
D2 has the formula =IF(B2="B","X","").
E2 has the formula =IF(B2="C","X","").
F2 has the formula =IF(B2="D","X","").

I'm sure this isn't the best way, but it now works.

Thanks for your help.
 
Upvote 0
You can do this with a single formula, take the first formula below enter it in B2, drag across then down


Book1
ABCDE
1Hours worked0-22-33-66+
21X   
35X
49X
52X
63X
76X
87X
95X
104X
112X
Sheet2
Cell Formulas
RangeFormula
B2=IF(COLUMN(A1)=MATCH($A2, {0,2,3,6,99}), "X", "")
C2=IF(COLUMN(B1)=MATCH($A2, {0,2,3,6,99}), "X", "")
D2=IF(COLUMN(C1)=MATCH($A2, {0,2,3,6,99}), "X", "")
E2=IF(COLUMN(D1)=MATCH($A2, {0,2,3,6,99}), "X", "")
 
Upvote 0

Forum statistics

Threads
1,215,884
Messages
6,127,562
Members
449,385
Latest member
KMGLarson

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