Simple "IF" statement for a newbie

ahmedsadak

New Member
Joined
Sep 19, 2019
Messages
5
I have a sheet which has a list of numbers ranging from -10000 to 10000. I need an IF statement which says if the number is less than -1500 then it should read "red" if it is less than -500 then read "amber" and if it is greater than -500 then should read "green"

I can get it do parts but struggling really, any help would be appreciated.
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
42,244
Office Version
365
Platform
Windows
Welcome to the MrExcel board!

.. if it is less than -500 then read "amber" and if it is greater than -500 then should read "green" ..
This doesn't tell us what to do if exactly equal to -500, but see if this is any use.

Excel Workbook
AB
1-5000
28000green
3-285green
4-55green
5-721amber
60green
7200green
redambergreen
 

ahmedsadak

New Member
Joined
Sep 19, 2019
Messages
5
Hi
thanks for the answer, sorry i wasnt clear enough, it should be less than or equal to or Greater than or equal to. - would i use LOOKUP rather than IF with an AND
 

LlebKcir

Board Regular
Joined
Oct 8, 2018
Messages
116
Nice, had no clue you could use Lookup in that way. I would have gone straight to conditional formatting with three color and use the => to set the values.
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
42,244
Office Version
365
Platform
Windows
This still isn't clear. Which one is it?
.. it should be less than or equal to or Greater than or equal to. ...
Please spell out again carefully in full the requirement for each colour result.
 

ahmedsadak

New Member
Joined
Sep 19, 2019
Messages
5
This still isn't clear. Which one is it?


Please spell out again carefully in full the requirement for each colour result.

Apologies.

A1 has a list of numbers.
between -10,000 and 10,000
B2 needs to say Red if the number in A1 is below or equal to -1500 or Amber if it is less than or equal to -500 or Red if it is greater than 500

Thanks in advance
 

LlebKcir

Board Regular
Joined
Oct 8, 2018
Messages
116
Apologies.

A1 has a list of numbers.
between -10,000 and 10,000
B2 needs to say Red if the number in A1 is below or equal to -1500 or Amber if it is less than or equal to -500 or Red if it is greater than 500

Thanks in advance
Are you saying you want the work RED, the word AMBER, and then the word RED again?

-1501RED
-600AMBER
600RED

<tbody>
</tbody>
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
42,244
Office Version
365
Platform
Windows
B2 needs to say Red if the number in A1 is below or equal to -1500 or Amber if it is less than or equal to -500 or Red if it is greater than 500
Carefully?? Is that last number supposed to be -500? And Red a second time?

Guessing, try
=IF(A1<=-1500,"Red",IF(A1<=-500,"Amber","Green"))

If the 500 at the end of that last quote is correct, what happens above -500 up to and including 500?
 
Last edited:

Forum statistics

Threads
1,082,065
Messages
5,362,976
Members
400,702
Latest member
oliviaalx

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top