If and statement

bflan0524

Board Regular
Joined
Oct 7, 2016
Messages
192
Office Version
  1. 2010
hello, looking for a formula that will identify if column A and b matches, example below
Biz SiteOfficer code
A000000802778

<tbody>
</tbody>
E63

<tbody>
</tbody>
A000000802778E63
A000008803992

<tbody>
</tbody>
A6Z

<tbody>
</tbody>
A000008803992

<tbody>
</tbody>
CUT

<tbody>
</tbody>

<tbody>
</tbody>

so for the first two rows i would want to be able to identify that both the biz site and officer code match, and in rows 3 & 4 the sites match but the officer codes dont
****** id="cke_pastebin" style="position: absolute; top: 68.8px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">
E63

<tbody>
</tbody>

<tbody>
</tbody>
</body>
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
I'm not sure if you want to flag all instances of matches, or only if there's a previous match, so here are 2 formulas for both ways:

ABCDE
1Biz SiteOfficer code
2A000000802778E63Multiple matches
3A000000802778E63Multiple matchesPrevious match
4A000008803992A6Z
5A000008803992CUT

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet11

Worksheet Formulas
CellFormula
C2=IF(COUNTIFS($A$2:$A$10,A2,$B$2:$B$10,B2)>1,"Multiple matches","")
D2=IF(COUNTIFS($A$2:$A2,A2,$B$2:$B2,B2)>1,"Previous match","")

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Hope this helps.
 
Upvote 0
hmm, this didn't work, is there a way for me to upload the file i did so i can show?
 
Upvote 0
This forum doesn't allow uploads. You can use a tool like the HTML Maker in my signature to show a screenprint, which is what I used. You can also upload a picture or a full file to a file sharing service and post a link. However, many people will not or cannot open such files for security reasons.

When you say "didn't work", what do you mean? Error message? If so, what? Wrong results? Please post a sample screen shot with the bad results on it, and the expected results. What version of Excel and/or Windows are you using? COUNTIFS was created in Excel 2007, so if you have an older version, this formula won't work, but we can probably come up with something else.
 
Upvote 0
Bzsite KeyOfficer Acct
A000000802778 E63Previous Match
A000000802778E63Previous Match
A000000802778E63Previous Match
A000000802778E63Previous Match
A000000802778CPO
A000000802778CPOPrevious Match
A000000802778E63Previous Match
A000000802778CPOPrevious Match
A000000802778CPOPrevious Match
A000000802778E63Previous Match
A000000802778E63Previous Match
A000000802778E63Previous Match
A000000802778E63Previous Match
A000000802778E63Previous Match
A000000802778E63Previous Match
A000000802778E63Previous Match

<colgroup><col><col><col></colgroup><tbody>
</tbody>

so i know this isnt great but this is the only way i could figure out how to put it up, you could assume columns are A, B and C
maybe i am not thinking of the right approach but in this example you could see under officer code column there are two what i will call owners, E63 and CPO. i would identify this as what i call a split ownership as opposed to one owner for all the sites.
that is what i am trying to identify if the ownership of these sites are split or just one officer code who owns it, does that make sense?

<colgroup><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><tbody></tbody>
 
Upvote 0
That's a little different from what I originally understood you to want. So given the example you showed, what would you want the results to be? You have a single site ID, and 2 owners. Would you want every line identified as "split"? If so, put this in C2:


=IF(COUNTIF($A$2:$A$20,A2)<>COUNTIFS($A$2:$A$20,A2,$B$2:$B$20,B2),"Split","")
 
Upvote 0
that worked thank you, so i always took countif as if you are actually counting the # of times a data point is the same, which is obv wrong looking at this. can you break this formula down for me? thanks again for the help
 
Upvote 0
It's actually pretty easy once you grasp the clever idea behind it (which I happily stole from someone else!). The first COUNTIF simply counts how many keys you have which match the key on the current line. The second COUNTIFS counts how many keys you have that match the key on the current line, AND that match the owner on the current line. If those 2 numbers are the same, then all the keys must have the same owner. If the 2 numbers are different, then there must be at least one matching key with a different owner.

Glad it works for you. :cool:
 
Upvote 0

Forum statistics

Threads
1,217,366
Messages
6,136,130
Members
449,993
Latest member
Sphere2215

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