If match then display 0 or 1

pateln1594

New Member
Joined
Jul 31, 2018
Messages
6
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]ID[/TD]
[TD]FULL ID[/TD]
[TD]LEFT ID[/TD]
[TD]RIGHT ID[/TD]
[TD]TYPE[/TD]
[/TR]
[TR]
[TD]1234[/TD]
[TD][/TD]
[TD]1234[/TD]
[TD][/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]2345[/TD]
[TD]2345[/TD]
[TD][/TD]
[TD][/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]3456[/TD]
[TD]3456[/TD]
[TD][/TD]
[TD][/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]6234[/TD]
[TD][/TD]
[TD][/TD]
[TD]6234[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]4657[/TD]
[TD][/TD]
[TD][/TD]
[TD]4657[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]6879[/TD]
[TD][/TD]
[TD][/TD]
[TD]6879[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]1243[/TD]
[TD][/TD]
[TD]1243[/TD]
[TD][/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]5436[/TD]
[TD]5436[/TD]
[TD][/TD]
[TD][/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]7896[/TD]
[TD][/TD]
[TD]7896[/TD]
[TD][/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]4894[/TD]
[TD]4894[/TD]
[TD][/TD]
[TD][/TD]
[TD]0[/TD]
[/TR]
</tbody>[/TABLE]


I am having trouble getting the values in Column "Type".
So the idea here is that I have a list of ID's for my device. Some of my devices are full devices, whereas some are only right or left devices. I want the type column to display 0 if they are full devices and display 1 if they are right or left devices. I want to do this using an excel formula not VBA.

I was trying to use the MATCH function to compare the ID column with full right and left columns and then if its a match result is 0 or 1 but I was not able to get the formula correct. Please help!!
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Is your data representative of all the possibilities you have, namely that:
- exactly one of Full ID, Left ID, Right ID will be populated per row
- the value filled out in Full ID, Left ID, Right ID will always match the ID

If those are not always true, can you post a few of the other examples, and expected results?

If those two conditions are always true, you could just use (assuming data resides in columns A-D and starts on row 2):
Code:
=IF(A2=B2,0,1)
 
Upvote 0
Hi,

Same assumption as Joe4, just reversed the logic for the formula:


Book1
ABCDE
1IDFULL IDLEFT IDRIGHT IDTYPE
2123412341
3234523450
4345634560
5623462341
6465746571
7687968791
8124312431
9543654360
10789678961
11489448940
Sheet164
Cell Formulas
RangeFormula
E2=--(A2<>B2)


Formula copied down.
 
Upvote 0
Another way:

[Table="width:, class:grid"][tr][td="bgcolor:#C0C0C0"][/td][td="bgcolor:#C0C0C0"]
A​
[/td][td="bgcolor:#C0C0C0"]
B​
[/td][td="bgcolor:#C0C0C0"]
C​
[/td][td="bgcolor:#C0C0C0"]
D​
[/td][td="bgcolor:#C0C0C0"]
E​
[/td][td="bgcolor:#C0C0C0"]
F​
[/td][/tr][tr][td="bgcolor:#C0C0C0"]
1​
[/td][td="bgcolor:#F3F3F3"]
ID
[/td][td="bgcolor:#F3F3F3"]
FULL ID
[/td][td="bgcolor:#F3F3F3"]
LEFT ID
[/td][td="bgcolor:#F3F3F3"]
RIGHT ID
[/td][td="bgcolor:#F3F3F3"]
Type
[/td][td="bgcolor:#F3F3F3"]
[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
2​
[/td][td]
1234​
[/td][td][/td][td][/td][td][/td][td="bgcolor:#CCFFCC"]Invalid[/td][td]E2: {=IF(COUNT(B2:D2)=1, INDEX($B$1:$D$1, MATCH(TRUE, ISNUMBER(B2:D2), 0)), "Invalid")}[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
3​
[/td][td]
2345​
[/td][td]
1234​
[/td][td][/td][td][/td][td="bgcolor:#CCFFCC"]FULL ID[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
4​
[/td][td]
3456​
[/td][td][/td][td]
1234​
[/td][td][/td][td="bgcolor:#CCFFCC"]LEFT ID[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
5​
[/td][td]
6234​
[/td][td]
1234​
[/td][td]
1234​
[/td][td][/td][td="bgcolor:#CCFFCC"]Invalid[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
6​
[/td][td]
4657​
[/td][td][/td][td][/td][td]
1234​
[/td][td="bgcolor:#CCFFCC"]RIGHT ID[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
7​
[/td][td]
6879​
[/td][td]
1234​
[/td][td][/td][td]
6879​
[/td][td="bgcolor:#CCFFCC"]Invalid[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
8​
[/td][td]
1243​
[/td][td][/td][td]
1243​
[/td][td]
1234​
[/td][td="bgcolor:#CCFFCC"]Invalid[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
9​
[/td][td]
5436​
[/td][td]
5436​
[/td][td]
1234​
[/td][td]
1234​
[/td][td="bgcolor:#CCFFCC"]Invalid[/td][td][/td][/tr]
[/table]
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,198
Members
452,617
Latest member
Narendra Babu D

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