SOLVED
Home

Excel: Combining IF and duplicate value

%3CLINGO-SUB%20id%3D%22lingo-sub-716234%22%20slang%3D%22en-US%22%3EExcel%3A%20Combining%20IF%20and%20duplicate%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-716234%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20473px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F120423iC33FAC3F6A6A89DE%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22example.PNG%22%20title%3D%22example.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHello%20everyone%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFirst%20of%20all%2C%20I'm%20just%20starting%20with%20excel%20so%20my%20question%20will%20probably%20look%20very%20stupid%20or%20basic%2C%20and%2C%20in%20advance%20I%20apologize%2C%20but%20I'm%20really%20struggling%20and%20this%20excel%20will%20be%20super%20important%20kind%20of%20follow%20up%20file.%3C%2FP%3E%3CP%3ESo%20the%20situation%3A%3C%2FP%3E%3CP%3EI%20have%20two%20teams%20that%20have%20to%20work%20on%20data.%3C%2FP%3E%3CP%3ETheses%20data%20are%20controlled%20by%20two%20numbers%2C%20e.g.%201111%2F00%2C%201111%2F10%2C%20etc...%20they%20are%20in%20two%20different%20columns.%3C%2FP%3E%3CP%3EIn%20my%20work%2C%20there%20is%20some%20risk%20that%20the%20two%20teams%20work%20on%20the%20same%20data%20at%20the%20same%20time%2C%20and%20I%20have%20to%20avoid%20it.%3C%2FP%3E%3CP%3ESo%20I%20will%20import%20these%20control%20numbers%20from%20two%20different%20excel%20sheet%20into%20one%20(4%20columns%20as%20on%20the%20example%20screenshot).%3C%2FP%3E%3CP%3EOn%20the%20screenshot%2C%20we%20can't%20separate%20the%20column%20A%20and%20B%20or%20D%20and%20E.%3C%2FP%3E%3CP%3EMy%20goal%20is%20to%20highlight%20the%20common%20sets%20of%20values%20(yellow%20lines%20in%20the%20example%2C%20that%20is%20highlighted%20by%20hand%20without%20any%20function).%20I%20would%20like%20something%20like%20IF%20on%20of%20the%20value%20A%20and%20B%20%3D%20one%20of%20the%20value%26nbsp%3BD%20and%20E%2C%20then%2C%20highlight%20the%204%20cells%20in%20red%20(or%20show%20WARNING).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20so%20much%20for%20your%20help%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHave%20a%20nice%20day%20%3A)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFlorent%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-716234%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-716270%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%3A%20Combining%20IF%20and%20duplicate%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-716270%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F365426%22%20target%3D%22_blank%22%3E%40Florent_be%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%3C%2FP%3E%3CP%3Eif%20you%20are%20allowed%20to%20create%20a%20helper%20column%20in%20column%20C%20that%20combines%20the%20values%20from%20A%20%26amp%3B%20B%3C%2FP%3E%3CP%3ESo%20in%20Cell%20C2%20you%20type%20%3DA2%26amp%3BB2%3C%2FP%3E%3CP%3Eand%20another%20helper%20column%20in%20column%20F%20that%20combines%20D%20%26amp%3B%20E%20%2C%3C%2FP%3E%3CP%3Eso%20in%20F2%20you%20type%20%3DD2%26amp%3BE2%3C%2FP%3E%3CP%3EThen%20you%20drag%20the%202%20calculations%20all%20the%20way%20down%3C%2FP%3E%3CP%3E%3CSTRONG%3EThen%20you%20need%20to%20create%202%20conditional%20formatting%20Rules%3A%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3ERule%201%3C%2FSTRONG%3E%26gt%3B%26gt%3B%20Select%20the%20values%20in%20columns%20D%20%26amp%3B%20E%20%26gt%3B%26gt%3B%20Home%20Tab%20%26gt%3B%26gt%3B%20Conditional%20Formatting%20%26gt%3B%26gt%3B%20New%20Rule%20%26gt%3B%26gt%3B%20Use%20Formula%20To%20determine%20which%20cell%20to%20format%20%26gt%3B%26gt%3B%20in%20the%20Formula%20box%20type%3A%26nbsp%3B%3DCOUNTIF(%24C%242%3A%24C%245%2C%24D2%26amp%3B%24E2)%26gt%3B%3D1%26nbsp%3B%20then%20%26gt%3B%26gt%3B%20Hit%20Format%20%26gt%3B%26gt%3B%20Fill%20Tab%20%26gt%3B%26gt%3B%20Yellow%20%26gt%3B%26gt%3B%20OK%20%26gt%3B%26gt%3BOk%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3ERule%202%3C%2FSTRONG%3E%26gt%3B%26gt%3B%20Select%20the%20values%20in%20columns%20A%20%26amp%3B%20B%20%26gt%3B%26gt%3B%20Home%20Tab%20%26gt%3B%26gt%3B%20Conditional%20Formatting%20%26gt%3B%26gt%3B%20New%20Rule%20%26gt%3B%26gt%3B%20Use%20Formula%20To%20determine%20which%20cell%20to%20format%20%26gt%3B%26gt%3B%20in%20the%20Formula%20box%20type%3A%20%3DCOUNTIF(%24F%242%3A%24F%245%2C%24A2%26amp%3B%24B2)%26gt%3B%3D1%20%26nbsp%3Bthen%20%26gt%3B%26gt%3B%20Hit%20Format%20%26gt%3B%26gt%3B%20Fill%20Tab%20%26gt%3B%26gt%3B%20Yellow%20%26gt%3B%26gt%3B%20OK%20%26gt%3B%26gt%3BOk%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20hide%20the%20preparation%20steps%20in%20columns%20C%20%26amp%3B%20F%20I%20changed%20the%20Font%20Color%20to%20white.%3C%2FP%3E%3CP%3EI%20also%20explained%20the%202%20rules%20in%20the%20worksheet%20columns%20J-K%26nbsp%3B%20%26amp%3B%20N-O%3C%2FP%3E%3CP%3EHope%20that%20Helps%3CBR%20%2F%3ENabil%20Mourad%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-716514%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%3A%20Combining%20IF%20and%20duplicate%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-716514%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20418px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F120424iC3B41B75BD7CBA07%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22example%202.PNG%22%20title%3D%22example%202.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F365248%22%20target%3D%22_blank%22%3E%40nabilmourad%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20mate%2C%3C%2FP%3E%3CP%3EThat's%20great%2C%20that's%20already%20a%20huge%20step%2C%20but%20I%20still%20have%20a%20problem%3A%3C%2FP%3E%3CP%3EThe%20formula%20is%20working%20great%20but%20it%20doesn't%20work%20if%20I%20update%20the%20list%3A%3C%2FP%3E%3CP%3E-%20The%20new%20data%20will%20turn%20red%20(I%20selected%20red%20instead%20of%20yellow)%2C%20but%20the%20data%20that%20was%20already%20in%20there%20doesn't%20change%3C%2FP%3E%3CP%3E-%20On%20the%20screenshot%2C%20the%20yellow%20fields%20are%20the%20data%20that%20should%20have%20changed%20but%20didn't.%3C%2FP%3E%3CP%3E-%20On%20the%20screenshot%2C%20the%20lines%206%20and%207%20are%20new%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20so%20much%2C%20your%20answer%26nbsp%3Bhelps%20me%20so%20much!!!!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFlo%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-717895%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%3A%20Combining%20IF%20and%20duplicate%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-717895%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F365426%22%20target%3D%22_blank%22%3E%40Florent_be%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20a%20comment%2C%20that%20could%20be%20done%20without%20helper%20columns%20with%20formula%20rule%20for%20columns%20A%20and%20B%20as%3C%2FP%3E%0A%3CPRE%3E%3DSUMPRODUCT(--ISNUMBER(MATCH(%24A1%26amp%3B%24B1%2C%24D%241%3A%24D%24100%26amp%3B%24E%241%3A%24E%24100%2C0)))*NOT(ISBLANK(%24A1))%3C%2FPRE%3E%0A%3CP%3Eand%20similar%20for%20Team%202%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-719040%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%3A%20Combining%20IF%20and%20duplicate%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-719040%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHello%20Sergei%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20your%20answer%2C%20that's%20exactly%20what%20I%20wanted!!!!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAgain%2C%20thank%20you!!!!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFlo%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-719203%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%3A%20Combining%20IF%20and%20duplicate%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-719203%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F365426%22%20target%3D%22_blank%22%3E%40Florent_be%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPersonally%20I%20would%20up%20the%20technology%20level%20to%20achieved%20improved%20functionality.%26nbsp%3B%20Both%20Team1%20and%20Team2%20data%20could%20be%20turned%20into%20tables%20in%20order%20to%20make%20all%20references%20dynamic.%26nbsp%3B%20The%20highlighting%20formulas%20may%20be%20developed%20using%20worksheet%20cells%20but%20ultimately%20Name%20Manager%20should%20be%20used%20to%20provide%20names%20for%20the%20formulas.%26nbsp%3B%20Thus%2C%20'%3CSTRONG%3Ehighlight1%3C%2FSTRONG%3E'%20(used%20for%20the%20table%20Team1)%20should%20refer%20to%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CFONT%3E%3D%20COUNTIFS(Team2%5BA%5D%2CTeam1%5B%40A%5D%2CTeam2%5BB%5D%2CTeam1%5B%40B%5D)%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CFONT%3Ewhilst%20the%20corresponding%20'%3CSTRONG%3Ehighlight2%3C%2FSTRONG%3E'%20would%20be%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CFONT%3E%3D%20COUNTIFS(Team1%5BA%5D%2CTeam2%5B%40A%5D%2CTeam1%5BB%5D%2CTeam2%5B%40B%5D)%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CFONT%3EThese%20named%20formulae%20are%20then%20used%20as%20the%20basis%20for%20conditional%20formatting.%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-720189%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%3A%20Combining%20IF%20and%20duplicate%20value%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-720189%22%20slang%3D%22en-US%22%3E%3CP%3EFlo%2C%20you%20are%20welcome%3C%2FP%3E%3C%2FLINGO-BODY%3E
Florent_be
New Contributor

example.PNG

 

Hello everyone,

 

First of all, I'm just starting with excel so my question will probably look very stupid or basic, and, in advance I apologize, but I'm really struggling and this excel will be super important kind of follow up file.

So the situation:

I have two teams that have to work on data.

Theses data are controlled by two numbers, e.g. 1111/00, 1111/10, etc... they are in two different columns.

In my work, there is some risk that the two teams work on the same data at the same time, and I have to avoid it.

So I will import these control numbers from two different excel sheet into one (4 columns as on the example screenshot).

On the screenshot, we can't separate the column A and B or D and E.

My goal is to highlight the common sets of values (yellow lines in the example, that is highlighted by hand without any function). I would like something like IF on of the value A and B = one of the value D and E, then, highlight the 4 cells in red (or show WARNING).

 

Thank you so much for your help

 

Have a nice day :)

 

Florent

 

6 Replies

@Florent_be 

Hi

if you are allowed to create a helper column in column C that combines the values from A & B

So in Cell C2 you type =A2&B2

and another helper column in column F that combines D & E ,

so in F2 you type =D2&E2

Then you drag the 2 calculations all the way down

Then you need to create 2 conditional formatting Rules:

Rule 1>> Select the values in columns D & E >> Home Tab >> Conditional Formatting >> New Rule >> Use Formula To determine which cell to format >> in the Formula box type: =COUNTIF($C$2:$C$5,$D2&$E2)>=1  then >> Hit Format >> Fill Tab >> Yellow >> OK >>Ok

 

Rule 2>> Select the values in columns A & B >> Home Tab >> Conditional Formatting >> New Rule >> Use Formula To determine which cell to format >> in the Formula box type: =COUNTIF($F$2:$F$5,$A2&$B2)>=1  then >> Hit Format >> Fill Tab >> Yellow >> OK >>Ok

 

To hide the preparation steps in columns C & F I changed the Font Color to white.

I also explained the 2 rules in the worksheet columns J-K  & N-O

Hope that Helps
Nabil Mourad

 

 

example 2.PNG

 

@nabilmourad 

Thanks mate,

That's great, that's already a huge step, but I still have a problem:

The formula is working great but it doesn't work if I update the list:

- The new data will turn red (I selected red instead of yellow), but the data that was already in there doesn't change

- On the screenshot, the yellow fields are the data that should have changed but didn't.

- On the screenshot, the lines 6 and 7 are new

 

Thank you so much, your answer helps me so much!!!!

 

Flo

Solution

@Florent_be 

As a comment, that could be done without helper columns with formula rule for columns A and B as

=SUMPRODUCT(--ISNUMBER(MATCH($A1&$B1,$D$1:$D$100&$E$1:$E$100,0)))*NOT(ISBLANK($A1))

and similar for Team 2

 

@Sergei Baklan 

Hello Sergei,

 

Thanks for your answer, that's exactly what I wanted!!!!

 

Again, thank you!!!!

 

Flo

@Florent_be 

Personally I would up the technology level to achieved improved functionality.  Both Team1 and Team2 data could be turned into tables in order to make all references dynamic.  The highlighting formulas may be developed using worksheet cells but ultimately Name Manager should be used to provide names for the formulas.  Thus, 'highlight1' (used for the table Team1) should refer to

= COUNTIFS(Team2[A],Team1[@A],Team2[B],Team1[@B])

whilst the corresponding 'highlight2' would be

= COUNTIFS(Team1[A],Team2[@A],Team1[B],Team2[@B])

These named formulae are then used as the basis for conditional formatting.

Flo, you are welcome

Related Conversations
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
13 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
22 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies
Edge insider Dev bypasses IE mode website list
HotCakeX in Enterprise on
4 Replies