Find data in 2 possible Columns, return other data

JTL9161

Well-known Member
Joined
Aug 29, 2012
Messages
593
Office Version
  1. 365
Platform
  1. Windows
Hope I can explain this clearly

I have 2 columns of data. I need to search for specific data "ABC" for example. When it finds it I need the data in the next column, meaning "GHI", but "ABC" could be in either column. It may not always be in the first column so if "ABC" was in the 2nd column I need the read the data in the 1st, so if "ABC" is in the 2nd column I would need to copy the "HIJ" data. If this is even doable.


ABCGHI
DEFQRS
XYZVWX
WXZPQR
HIJABC
FGHHUT


Thanks,
James
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Will it only ever appear exactly ONCE in these two columns?
If it may appear more than once, which record should it return the value for?
 
Upvote 0
"ABC" would only show once in either column, as with all others. Each string entered only 1 time.
 
Upvote 0
OK, let's say that your data is in the range A1:B8, and we want to look up the value we place in cell E1.
Then place this formula in cell F1:
Excel Formula:
=IFERROR(INDEX(B1:B8,MATCH(E1,A1:A8,0)),INDEX(A1:A8,MATCH(E1,B1:B8,0)))

And here are two examples showing this working:
1731601565170.png


1731601593084.png
 
Upvote 0
Another option:
Book1
ABCDEF
1ABCGHIABCABCGHI
2DEFQRS
3XYZVWX
4
5
6WXZPQRABCHIJABC
7HIJABC
8FGHHUT
Sheet7
Cell Formulas
RangeFormula
E1:F1,E6:F6E1=FILTER(A1:B3,(A1:A3=D1)+(B1:B3=D1))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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