Excel - IF Function Problem - Expert Solution

Question description:
This user has given permission to use the problem statement for this blog.

I was wondering if there was a code to preset a Color Fill (8 different color choices) in a cell, and the color chosen would be determined based on a range of numbers? For example, Maroon would be filled if the number entered was from 45-70; Red would be 36-44; Yellow 28-35 etc.
Solved by X. F. in 20 mins
This is the chat thread from the real Excelchat help session. It contains no private user information.
Excelchat Expert 20/06/2018 - 09:39
Hello :)
User 20/06/2018 - 09:39
Hi! Thank you for trying to help me :)
Excelchat Expert 20/06/2018 - 09:39
I understand you would like to conditionally format a cell for specific colors based on the number in that cell correct?
User 20/06/2018 - 09:40
Yes, a preset color with a preset set of numbers
User 20/06/2018 - 09:40
I dont know if that kind of code exists though
Excelchat Expert 20/06/2018 - 09:40
Yup, so I will let you choose the colors, but I can show you how to code it.
Excelchat Expert 20/06/2018 - 09:41
What are your ranges/colors?
User 20/06/2018 - 09:41
This will take a moment to type up, one second
Excelchat Expert 20/06/2018 - 09:43
Sure, I'll be here when you're ready
User 20/06/2018 - 09:45
Purple - 0 to 10; Dark Blue - 10.1 to 17; Light Blue - 17.1 to 22; Dark Green - 22.1 to 27; Light Green - 27.1 to 34; Yellow - 34.1 to 37; Light Red - 37.1 to 45; Dark Red - 45.1 to 70
Excelchat Expert 20/06/2018 - 09:49
Okay, I'll use the ranges you sent to create the formatting.
Excelchat Expert 20/06/2018 - 09:49
I'll send you a link so you can see the changes as I make them.
User 20/06/2018 - 09:49
Thank you! :D
Excelchat Expert 20/06/2018 - 09:50
https://docs.google.com/spreadsheets/d/1o7ZukM1Mgwyb5TaZ9bF_w-qBLRvdNfDKOPchIgqfu2U/edit?usp=sharing
User 20/06/2018 - 09:50
Got it!
Excelchat Expert 20/06/2018 - 09:50
Perfect.
User 20/06/2018 - 09:55
Sorry, im not sure that im following along with the functions/coding
Excelchat Expert 20/06/2018 - 09:55
I'll show you the code after I have it complete.
Excelchat Expert 20/06/2018 - 09:55
It will be in Data Validation.
Excelchat Expert 20/06/2018 - 09:56
You do see that it is working so far though right?
User 20/06/2018 - 09:56
I see that there are numbers being entered into a cell, and a color being applied after.
User 20/06/2018 - 09:56
I dont know what is happening behind the scene though
User 20/06/2018 - 09:57
Also will you be able to show me after the session ends? Or will that be it
Excelchat Expert 20/06/2018 - 09:57
I'm not changing the color, the formula is.
Excelchat Expert 20/06/2018 - 09:57
oh, please extend the session
User 20/06/2018 - 09:57
Ohhhh
Excelchat Expert 20/06/2018 - 09:57
It should be at the top right
Excelchat Expert 20/06/2018 - 09:57
in this chat
User 20/06/2018 - 09:58
Im not sure how to
Excelchat Expert 20/06/2018 - 09:58
I'll leave instructions on the link
Excelchat Expert 20/06/2018 - 09:58
for the formulas.
User 20/06/2018 - 09:58
Oh thank you so much!
Excelchat Expert 20/06/2018 - 09:58
In the meantime, please change cell A10 to play with the numbers that I have done already

This is the output file from the real Excelchat help session:
This is an example of the expert help you can get. It contains no private user information.

Get instant expert help with Excel and Google Sheets

Post your problem and you’ll get expert help in seconds.

Your message must be at least 40 characters
Your privacy is guaranteed. Your session will not be used for blog unless you give us persmission.