Identify Rows Based on 3 Columns

Irishred

New Member
Joined
Feb 2, 2012
Messages
6
Hello,

I am currently taking the data into Access in order to do this but I feel like I should be able to do this in Excel but I am not getting the results that I need. I tried various IF and AND functions without success.

I have data in which I am trying to identify the rows where the worksheet does not contain the same serial and version with a one record having a sign of "Pos" and and one record having a Sign of "Neg" When both are present then I want to treat it as an offsest and ignore it. It's only an offset if the Serial and Version are the same and there is at least one Pos and one Neg Sign for each set.

In the below the first two records are an offset as I have a Sign of Pos and Neg for the same Serial and Version.

The next set, Serial 433720 with version 940 has 2 Pos but no Neg so I want to identify this as "No Offset"

The last record, 857405 with version 832 only has a Pos sign so I would want to identify that also as "No Offset"

SerialVersionSign
246732749Pos
246732749Neg
433720940Pos
433720940Pos
857405832Pos

Thank you
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Perhaps:

ABCDE
1SerialVersionSignResult
2246732749PosOffset
3246732749NegOffset
4433720940PosNo Offset
5433720940PosNo Offset
6111111222PosOffset
7222222333NegNo Offset
8222222333NegNo Offset
9111111222PosOffset
10111111222NegOffset
11857405832PosNo Offset
Sheet1
Cell Formulas
RangeFormula
E2:E11E2=IF(AND(COUNTIFS(A$2:A$11,A2,B$2:B$11,B2,C$2:C$11,{"Pos","Neg"})),"","No ")&"Offset"

It would be good if you could let us know in your Account details what version of Excel you're using, as the best solution will sometimes vary by version.

If you're not using the latest version of Excel, you will need to array-enter the above formula, i.e. Control-Shift-Enter rather than Enter.
 
Upvote 0
What if you have 2 Pos and 1 Neg. Would the 2nd Pos labeled as "Offset"?
 
Upvote 0
Perhaps:

ABCDE
1SerialVersionSignResult
2246732749PosOffset
3246732749NegOffset
4433720940PosNo Offset
5433720940PosNo Offset
6111111222PosOffset
7222222333NegNo Offset
8222222333NegNo Offset
9111111222PosOffset
10111111222NegOffset
11857405832PosNo Offset
Sheet1
Cell Formulas
RangeFormula
E2:E11E2=IF(AND(COUNTIFS(A$2:A$11,A2,B$2:B$11,B2,C$2:C$11,{"Pos","Neg"})),"","No ")&"Offset"

It would be good if you could let us know in your Account details what version of Excel you're using, as the best solution will sometimes vary by version.

If you're not using the latest version of Excel, you will need to array-enter the above formula, i.e. Control-Shift-Enter rather than Enter.I a
I am using Excel 2016, I should have mentioned that. Thank you for the reminder.

Yes, this worked. Thank you so much. I spent a good amount of time attempting to figure this out and then more taking it to Access and back. Really appreciate the help on this !
 
Upvote 0
What if you have 2 Pos and 1 Neg. Would the 2nd Pos labeled as "Offset"?
I tested and it does not mark the second as an offset. I will dedupe as a prestep to running this until I find a way to treat multiple as an offset if there is a negative. Thank you for raising this question.
 
Upvote 0
It's only an offset if the Serial and Version are the same and there is at least one Pos and one Neg Sign for each set.
My post #2 took this to mean that a set of 3, say, with 2 Pos and One Neg, would all be marked "Offset".
What if you have 2 Pos and 1 Neg. Would the 2nd Pos labeled as "Offset"?
I tested and it does not mark the second as an offset.
The formula in Post #2 does mark the second as an offset.

So I'm confused about the results you're looking for?

If you want the "Offset" tag to apply only to Pos/Neg pairs, then you could try:
ABCDE
1SerialVersionSignResult
2A111PosOffset
3A111NegOffset
4B222PosOffset
5B222NegOffset
6C333PosOffset
7D444NegNo Offset
8D444NegNo Offset
9C333PosNo Offset
10C333NegOffset
11E555NegOffset
12F666NegOffset
13E555NegOffset
14F666NegOffset
15E555PosOffset
16F666PosOffset
17E555NegNo Offset
18F666PosOffset
19F666PosNo Offset
20E555PosOffset
Sheet1
Cell Formulas
RangeFormula
E2:E20E2=IF(COUNTIFS(A$2:A2,A2,B$2:B2,B2,C$2:C2,C2)>MIN(COUNTIFS(A$2:A$20,A2,B$2:B$20,B2,C$2:C$20,{"Pos","Neg"})),"No ","") &"Offset"
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,215,200
Messages
6,123,611
Members
449,109
Latest member
Sebas8956

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