简体   繁体   中英

Change colour on row in one sheet if same value exists in second sheet

I have a sheet named Skruvdragare where cells B1-B500 contain serial numbers like: 123456789 , 987654321 etc and a second sheet Låda 1 in which I will also put in some serial numbers (not necessarily the same numbers as in the Skruvdragare sheet).

If I put in a serial number, anywhere in Låda 1 , which exists in Skruvdragare I want the row for this serial number to turn to red background and white text in the Skruvdragare sheet.

Use Conditional Formatting for this. But, as I've learned right now, the formula must not contain references to other sheets...so we work around this limitation by putting the formula into an auxiliary column in sheet2:

=NOT(ISERROR(MATCH($A1,sheet1!$A$1:$A$500,0)))

and the conditional format just contains the formula

=$D1

if the aux column was "D". Copy that format to as many cells you like (except for the aux column!).

Please Define Name of Workbook Scope for Låda 1 , say OtherSheet :

  1. Select the cell, range of cells, or nonadjacent selections that you want to name.

  2. Click the Name box at the left end of the formula bar.

在此处输入图片说明

Name box

  1. Type the name that you want to use to refer to your selection. Names can be up to 255 characters in length.

  2. Press ENTER.

Select from Row1 to Row500 in Skruvdragare and HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true: :

=COUNTIF(OtherSheet,$B1)

Format... , select red fill white font, OK, OK.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM