How to use conditional formatting to color the row in red based on cell value in other sheet

Ramadan2512

Board Regular
Joined
Sep 7, 2024
Messages
68
Office Version
  1. 2021
Platform
  1. Windows
I have two worksheets, sheet1 is a table to list tasks with the unit number named "task" and sheet2 is a table to list the task handling progress named "progress" . and i need to color the task row in sheet1 in red if the same task is mentioned in sheet2 and date is mentioned as done in sheet2 as you can see in screenshot

for example in the screenshot (if C2 in "sheet1"= any cell of "C" in "sheet2" and "H2" IS NOTBLANK) then color entire row in "sheet1" in red

So what is the formula that i can use in conditional formatting to do that
 

Attachments

  • Untitled.png
    Untitled.png
    24.4 KB · Views: 8

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
is the unit number UNIQUE
if it is and only appears once - then all you need is a countif() and AND - if have to match all 3 then a counitifs() for all 3 conditions and an AND

maybe an An AND with a countifs() the range will change to match your real data - but this is based on the image

countifs(task!C5:C100, progress!C15, task!D5:D100, progress!D15, task!E5:E100, progress!E15)
if you need to match all 3 elements
AND($H15<>"", countifs(task!$C$5:$C$100, progress!$C15, task!$D$5:$D$100, progress!$D15, task!$E$5:$E$100, progress!$E15)>0)
in a conditionally formatting rule

Note: Images are difficult to see , and also requires that I input all the data myself, which means I may make an error, which is very time consuming, and from my point of view less likely to get a response, if a complicated spreadsheet. Plus we cannot see any of the formulas used.

Therefore -

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
=AND($H2<>"", COUNTIFS(task!$C$2:$C$24,$C2,task!$D$2:$D$24,$D2,task!$E$2:$E$24,$E2)>0)

setting up in 2 sheets as descibed - rather than the image

cond-frmt-progress task sheets-ETAF.xlsx
ABCDEFGH
1SUNITTASKDeptDateEmployeeDone
21RT10 - 21TASK1UH10/1/241
32RWO8 - 60TASK2DF10/2/242
43RW10 - 70TASK3RT10/3/2432-Nov-24
Progress
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:H4Expression=AND($H2<>"", COUNTIFS(task!$C$2:$C$24,$C2,task!$D$2:$D$24,$D2,task!$E$2:$E$24,$E2)>0)textYES


cond-frmt-progress task sheets-ETAF.xlsx
ABCDE
1SUNITTASKDept
21RT10 - 21TASK1UH
32RWO8 - 60TASK2DF
43RW10 - 70TASK3RT
5
task


also on a share BUT only for a few days
 
Upvote 0
=AND($H2<>"", COUNTIFS(task!$C$2:$C$24,$C2,task!$D$2:$D$24,$D2,task!$E$2:$E$24,$E2)>0)

setting up in 2 sheets as descibed - rather than the image

cond-frmt-progress task sheets-ETAF.xlsx
ABCDEFGH
1SUNITTASKDeptDateEmployeeDone
21RT10 - 21TASK1UH10/1/241
32RWO8 - 60TASK2DF10/2/242
43RW10 - 70TASK3RT10/3/2432-Nov-24
Progress
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:H4Expression=AND($H2<>"", COUNTIFS(task!$C$2:$C$24,$C2,task!$D$2:$D$24,$D2,task!$E$2:$E$24,$E2)>0)textYES


cond-frmt-progress task sheets-ETAF.xlsx
ABCDE
1SUNITTASKDept
21RT10 - 21TASK1UH
32RWO8 - 60TASK2DF
43RW10 - 70TASK3RT
5
task


also on a share BUT only for a few days
Thank you so much for your effort and and being patient to explain - but unfortunately I'm confused and don't understand why you put "E" column in the formula..

What I need simply is two conditions (based on your shared sheets) condition #1 (if "C" in task = any cell of "C" in prgress,) condition #2 (AND the date cell "F" in progress <>"") then color the row . that's all
and as you asked before yes the unit number in C maybe repeated more than once not unique but date cell "F" can only be blank once so I depend on this cell to make the difference

thank you so much in advance
 
Upvote 0
ok
so then all you need is a countif() so all you are doing is match the column c
=AND($H2<>"", COUNTIF(task!$C$2:$C$24,$C2)>0)
as the contents of D AND E wont make any difference

is it F or H ???? you are are trying to match
you example says H is not blank
now you say F
(AND the date cell "F" in progress <>"")
F is not blank in any of the rows - so how is that now matched

AS the task sheet does not have dates and none of the progress sheets F are blank
confused

=AND($H2<>"", COUNTIF(task!$C$2:$C$24,$C2)>0)

cond-frmt-progress task sheets-ETAF.xlsx
ABCDEFGH
1SUNITTASKDeptDateEmployeeDone
21RT10 - 21TASK1UH10/1/241
32RWO8 - 60TASK2DF10/2/242
43RW10 - 70TASK3RT10/3/2432-Nov-24
Progress
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:H4Expression=AND($H2<>"", COUNTIF(task!$C$2:$C$24,$C2)>0)textYES


 
Upvote 0
Sorry I mean Date Cell "H" not "H" which is done
ok i assume you mean H NOT F
and i have shown the solution just matching on column C , the UNIT

BUT basically the task code just needs to exist in the TASK table as thats all you are really checking , does TASK exist

SO if it did have a date in H - BUT was not on the task list - it would not colour
 
Upvote 0
I'm trying to apply the formula in conditional formating but I get a message that (I cannot use reference to other worksheet in conditional formating
sorry if i didn't mention that the tow sheets are not in the same workbook but different workbooks I though may not effect
and also in your last formula =AND($H2<>"", COUNTIF(task!$C$2:$C$24,$C2)>0) there is not mention to prgress worksheet ???
 
Upvote 0
so no need to mention progress sheet as the conditional formatting is in that sheet
so
$H2
could be
'progress'!$H2
and
$C2
could be
'progress'!$C2
But no need as the conditional formatting is in the progress sheet

AND(progress!$H2<>"", COUNTIF(task!$C$2:$C$24,progress!$C2)>0)

other worksheet
OR a different workbook ????
confused now

Then maybe more complicated as both workbooks would need to also be OPEN , if the TASK workbook is closed - then need to use a formula that will work with closed workbooks - and need the full path of where the workbook is , if in a different folder
need to look into that
BUT meanwhile
Explain where is the TASK workbook going to exist - on a PC, same folder , different folder , a share , ONLINE , sharepoint etc
 
Upvote 0
so no need to mention progress sheet as the conditional formatting is in that sheet
so
$H2
could be
'progress'!$H2
and
$C2
could be
'progress'!$C2
But no need as the conditional formatting is in the progress sheet

AND(progress!$H2<>"", COUNTIF(task!$C$2:$C$24,progress!$C2)>0)

other worksheet
OR a different workbook ????
confused now

Then maybe more complicated as both workbooks would need to also be OPEN , if the TASK workbook is closed - then need to use a formula that will work with closed workbooks - and need the full path of where the workbook is , if in a different folder
need to look into that
BUT meanwhile
Explain where is the TASK workbook going to exist - on a PC, same folder , different folder , a share , ONLINE , sharepoint etc
both workbooks are on my pc desktop
here I share both of my files with you in this link ( Download Data package from November 26th.)
 
Upvote 0

Forum statistics

Threads
1,224,507
Messages
6,179,181
Members
452,893
Latest member
denay

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