Conditional Formatting

carrieebacon

New Member
Joined
Jan 15, 2024
Messages
49
Office Version
  1. 365
Platform
  1. Windows
I suck at this (I am sure it is simple and I am just clueless) but I need a rule for column D that says "if the value in cell =TOLERANCE!D6 is less than 0.10 when subtracted from =DESIGN!D6, format the cell green. If the value is greater than 0.10 but less than 0.50, format the cell yellow. If the value is greater than 0.50, format the cell red." I need this to apply down the whole column for each respective cell. Should I even be using conditional formatting for this?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Should I even be using conditional formatting for this?
yes

3 rules , 1 for each colour

column D in what sheet ?

=(DESIGN!D6-TOLERANCE!D6) < 0.1

format green
for 2007, 2010 , 2013 , 2016 , 2019 or 365 Subscription excel version
Conditional Formatting

Highlight applicable range >>
D6:D1000 - Change, reduce or extend the rows to meet your data range of rows

Home Tab >> Styles >> Conditional Formatting
New Rule >> Use a formula to determine which cells to format
Edit the Rule Description: Format values where this formula is true:
=(DESIGN!D6-TOLERANCE!D6) < 0.1

Format [Number, Font, Border, Fill]
choose the format you would like to apply when the condition is true
OK >> OK

=(DESIGN!D6-TOLERANCE!D6) > 0.5
RED

then
=(DESIGN!D6-TOLERANCE!D6) < = 0.5

put in that order and use stop if true

so that when less than .1 it stops and does not go onto <=0.5

A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

This will possibly enable a quicker and more accurate solution for you.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC

then put the sample spreadsheet onto a share

I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed

Make sure you set any share or google to share to everyone
 
Upvote 0
This worked! Is there any way I can set it to if a value is not in a cell yet, it will not be formatted?
 
Upvote 0
=AND( DESIGN!D6 <> "", TOLERANCE!D6 <>"", ( DESIGN!D6-TOLERANCE!D6 )< 0.1)
=AND( DESIGN!D6 <> "", TOLERANCE!D6 <>"", ( DESIGN!D6-TOLERANCE!D6 )> 0.5)
=AND( DESIGN!D6 <> "", TOLERANCE!D6 <>"", ( DESIGN!D6-TOLERANCE!D6 )< = 0.5)
that will do if both cells have to be blank to colour

is that what you meant ??

other wise to test if either
add an OR

=AND( OR(DESIGN!D6 <> "", TOLERANCE!D6 <>""), ( DESIGN!D6-TOLERANCE!D6 )< 0.1)
=AND( OR(DESIGN!D6 <> "", TOLERANCE!D6 <>""), ( DESIGN!D6-TOLERANCE!D6 )> 0.5)
=AND( OR(DESIGN!D6 <> "", TOLERANCE!D6 <>""), ( DESIGN!D6-TOLERANCE!D6 )< = 0.5)
 
Upvote 0
ASB COPY

This is a link to a mock version of the spreadsheet. I'm probably not explaining it very well, but I would like to input data into columns D, F, I, and L and once a value is inputted, the cell will format.
 
Upvote 0
and as for the formula, let me reword this. If the difference between the values in cell DESIGN!D6 and TOLERANCE!D6 is greater than 0.5, highlight the cell red etc. etc.
 
Upvote 0
thanks for the link , that will make things easier

however
but I need a rule for column D that says "if the value in cell =TOLERANCE!D6 is less than 0.10 when subtracted from =DESIGN!D6, format the cell green. If the value is greater than 0.10 but less than 0.50, format the cell yellow. If the value is greater than 0.50, format the cell red." I need this to apply down the whole column for each respective cell. Should I even be using conditional formatting for this?
but I need a rule for column D
On what Sheet ?

=TOLERANCE!D6 is less than 0.10 when subtracted from =DESIGN!D6, format the cell green.
Why ROW 6 ?

and not row 2 - where the data seems to start on both sheets

but I would like to input data into columns D, F, I, and L and once a value is inputted, the cell will format.
On what sheets

it can be done with conditional formatting and some logic tests to check if the cells are blank or have data entered

If the difference between the values in cell DESIGN!D6 and TOLERANCE!D6 is greater than 0.5, highlight the cell red etc. etc.
Yep, that was one of the rules to colour RED
=(DESIGN!D6-TOLERANCE!D6) > 0.5
RED

HIGHLIGHT WHAT CELL?


DESIGN SHEET
ASB COPY.xlsx
ABCDEFGHIJKLM
1STR. IDIDTOPELV.INV.ELV.DIR.INV.ELV.DIR.INV.ELV.DIR.
2CI11FR:19.39INV. IN6.08WINV. IN9.08NINV. OUT6.08E
3CI15FR:19INV. IN3NINV. IN9EINV. OUT3S
4CI154FR:18.15INV. IN12.16EINV. OUT12.16W
5CI155FR:18.01INV. IN12.4EINV. OUT12.4W
6CI156FR:18.63INV. IN12.64EINV. OUT12.64W
7CI157FR:18.01INV. IN12.81EINV. OUT12.81W
8CI164FR:18.56INV. OUT13W
9CI165FR:18.56INV. IN11.59EINV. OUT11.59W
10CI167FR:18.23INV. OUT13E
11CI169FR:18.1INV. IN12.56NINV. OUT12.56S
12CI172FR:18.21INV. OUT13S
13CI173FR:14.04INV. OUT3E
14CI175FR:14.91INV. OUT3NE
15CI185FR:18.06INV. IN8.26WINV. OUT7.75SE
16CI186FR:18.19INV. OUT12E
DESIGN


TOLARANCE SHEET
ASB COPY.xlsx
ABCDEFGHIJKLM
1STR. IDIDTOPELV.INV.ELV.DIR.INV.ELV.DIR.INV.ELV.DIR.
2CI11FR:INV. IN-19.5WINV. IN-19.3NINV. OUT-18.2E
3CI15FR:INV. IN-18.5NINV. IN-18.4EINV. OUT-18.4S
4CI154FR:INV. IN-11.162EINV. OUT-9.762W
5CI155FR:INV. INEINV. OUTW
6CI156FR:INV. INEINV. OUTW
7CI157FR:INV. INEINV. OUTW
8CI164FR:INV. OUTW
9CI165FR:INV. INEINV. OUTW
10CI167FR:INV. OUTE
11CI169FR:INV. INNINV. OUTS
12CI172FR:INV. OUTS
13CI173FR:INV. OUTE
14CI175FR:INV. OUTNE
15CI185FR:INV. INWINV. OUTSE
16CI186FR:INV. OUTE
TOLERANCE
 
Upvote 0
Oop sorry, when I made the copy spreadsheet in excel I copied from row 5 down because the company logo is in row 1-4. So yes in the ASB COPY the data starts in row 2. The formula would be in the tolerance sheet. So I am going to use F6 for example. In design, the value is 6.08. In tolerance, it is -19.5, which means it's clearly incorrect by ALOT. So because the difference is greater than 0.50, the cell F6 in tolerance would be red. If a value in design said 5.90 but in tolerance it said 5.88, the cell would be green because the difference is less than 0.10. If a value in design said 5.90, but in tolerance it said 5.60, the cell would be yellow because the difference is greater than 0.10 but less than 0.50.
 
Upvote 0
ok, so i can add rows to 1-4 so we are on the same row as needed

so we want cell tolerance!F to be coloured - NOT D
and only when a number is entered into tolerance!F

so we still use - ????
=DESIGN!F6-TOLERANCE!F6 (will negative numbers still work for you - ... with the tolerance - so is -0.6 wrong as that is NOT greater than 0.5 - BUT maybe we need to use ABS() regardeless than of sign -
6.08 - - 19.5
will give a plus
which is 25.58

ANYWAY

and then test for a value > 0.5
and only if
TOLERANCE!F6
has a value
=AND( TOLERANCE!F6<>"", (DESIGN!F6-TOLERANCE!F6)>0.5)

Select F6:F1000 or what ever range
and use the formula
=AND( TOLERANCE!F6<>"", (DESIGN!F6-TOLERANCE!F6)>0.5)

see below
I will add to dropbox for a day or 2
what about
but I would like to input data into columns D, F, I, and L

No data is in D in this example - so should that not colour

feels like we may need to go through a few iterations to get this right - happy to do that

so below is just RED

dropbox link
only for a few days

hence the xl2bb below - which can stay and help others



ASB COPY.xlsx
ABCDEFGHIJKLMNO
1
2
3
4
5STR. IDIDTOPELV.INV.ELV.DIR.INV.ELV.DIR.INV.ELV.DIR.
6CI11FR:INV. IN-19.5WINV. IN-19.3NINV. OUT-18.2E25.58
7CI15FR:INV. IN-18.5NINV. IN-18.4EINV. OUT-18.4S
8CI154FR:INV. IN-11.162EINV. OUT-9.762W
9CI155FR:INV. IN12.4EINV. OUTW
10CI156FR:INV. INEINV. OUTW
11CI157FR:INV. INEINV. OUTW
TOLERANCE
Cell Formulas
RangeFormula
O6O6=DESIGN!F6-TOLERANCE!F6
Cells with Conditional Formatting
CellConditionCell FormatStop If True
F6:F63Expression=AND( F6<>"", (DESIGN!F6-F6)>0.5)textNO
 
Upvote 0
added the other 2 rules for green and amber

and used your values - for green / amber in rows 7 and 8



ASB COPY -ETAF1.xlsx
ABCDEFGHIJKLMN
1
2
3
4
5STR. IDIDTOPELV.INV.ELV.DIR.INV.ELV.DIR.INV.ELV.DIR.
6CI11FR:INV. IN-19.5WINV. IN-19.3NINV. OUT-18.2E25.58
7CI15FR:INV. IN5.88NINV. IN-18.4EINV. OUT-18.4S0.02
8CI154FR:INV. IN5.6EINV. OUT-9.762W0.3
9CI155FR:INV. IN12.4EINV. OUTW0
10CI156FR:INV. IN13EINV. OUTW-0.36
11CI157FR:INV. IN14EINV. OUTW-1.19
12CI164FR:INV. OUT-12W25
13CI165FR:INV. IN11.09EINV. OUTW0.5
14CI167FR:INV. OUT13E0
15CI169FR:INV. IN12.06NINV. OUTS0.5
16CI172FR:INV. OUTS13
17CI173FR:INV. OUTE3
18CI175FR:INV. OUTNE3
19CI185FR:INV. INWINV. OUTSE8.26
TOLERANCE
Cell Formulas
RangeFormula
N6:N19N6=DESIGN!F6-TOLERANCE!F6
Cells with Conditional Formatting
CellConditionCell FormatStop If True
F6:F63Expression=AND( F6<>"", (DESIGN!F6-F6)<0.1)textYES
F6:F63Expression=AND( F6<>"", (DESIGN!F6-F6)<=0.5)textYES
F6:F63Expression=AND( F6<>"", (DESIGN!F6-F6)>0.5)textYES
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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