IF function using negative numbers an 3 options

22222222

New Member
Joined
Nov 5, 2013
Messages
4
I'm trying to make a cell do the following :

if cell H12 is above 5 show "above", if it is below -5 show "below", if it is between -5 and 5 (not including 5 or -5) show in line.

Can anyone tell me what I need to type in... I have tried all sorts !:confused:

Big thanks in advance
 

Some videos you may like

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.

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Welcome to the board.

Try
=IF(H12<-5,"below",IF(H12>5,"above","in line"))
 

22222222

New Member
Joined
Nov 5, 2013
Messages
4
Thank you soooooooo much !!!
Id it possible to apply a colour to each e.g. in line is blue, below is red etc?
or would I have to use a conditional format to do this?

Huge thanks
 

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Glad to help, thanks for the feedback.

Yes, You need conditional formatting for that..
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,201

ADVERTISEMENT

What if H12 = -5 or if H2 = 5?
 

22222222

New Member
Joined
Nov 5, 2013
Messages
4
Just having one small problem , it seems to be showing "in line" for everything
any help - greatly appreciated
thanks
 

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Just having one small problem , it seems to be showing "in line" for everything
any help - greatly appreciated
thanks

That would mean all your numbers are between (and including) -5 and 5

Are you sure your numbers are whole numbers and not decimals?
Are they perhaps 0.xx ?
 

22222222

New Member
Joined
Nov 5, 2013
Messages
4
They were % - I forgot to mention that :eek:!
I've put the % sign in and it works! - big thank you it will save me hours of work ;)
 

Watch MrExcel Video

Forum statistics

Threads
1,122,891
Messages
5,598,680
Members
414,254
Latest member
MarieCo

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