Search 2 columns, for MATCH in column in a second sheet, insert value

davidmyers

Board Regular
Joined
Jan 29, 2017
Messages
88
Office Version
  1. 2016
Platform
  1. Windows
Hi, I have 2 sheets, I want to search / match Sheet2 cols A or B with the value in Sheet3 col. C, if there's a match
I also need both col A & B in Sheet2 to be numeric (neither cell blank), if these criteria are met then Sheet3 col D = "BZ" else blank.
What's the best way to do this?
Any help much appreciated.
sheet2-3.png
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
I combined all into one worksheet, you'll have to adjust your references. I also shortened the data strings.
If you have 365 (Please update your profile to show what version you have) there maybe more elegant solutions.
You may need to use the CNTL-SHFT-ENTR keystroke to commit the formula to the cell.


But, I will say this. Your sample data does not really give enough information to test false scenarios. Please test thoroughly.

Book1
ABCDEFGHI
1Sheet3Sheet2
2IDComplaints & Usesspecies-idBZBerc IDMemp IDSpecies Name
352837Imp2BZ8052Arbu
452835Lax2BZ9033Anet
552836Camin2BZ9934Arte
652802Stom3BZ7745Capp
752805Influ3BZ8346Cera
852803Sever3BZ8207Thym
952804Eye3BZ14Acan
1052865Urin4BZ32715Achi
1152869Hali4BZ76116Adia
1252870Tooth4BZ
1352854Heart4BZ
1452855Vomi4BZ
1552856Wash4BZ
1652857Excess4BZ
1752859Gastro4BZ
1852860Nausa4BZ
Sheet3
Cell Formulas
RangeFormula
D3:D18D3=IF(SUM((IFERROR(MATCH($G$3:$G$11,C3,0),0)+IFERROR(MATCH($H$3:$H$11,C3,0),0))*(ROW($G$3:$G$11)-2)), IF(SUM(--(ISNUMBER(INDEX($G$3:$H$11, SUM((IFERROR(MATCH($G$3:$G$11,C3,0),0)+IFERROR(MATCH($H$3:$H$11,C3,0),0))*(ROW($G$3:$G$11)-2)),0)))), "BZ",""),"")
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Hi awooha,
Thanks very much for taking the time to write this formula, never realized how complicated it would be, I would never
have arrived to this level. I created 1 sheet, copied your format and changed the formula to include the whole worksheet.
I was unable to upload the bbcode - kept getting error "generated content exceeds limit allowed".
So here's my amended formula to include all G-H rows:

Excel Formula:
=IF(SUM((IFERROR(D9MATCH($G$3:$G$315,C3,0),0)+IFERROR(MATCH($H$3:$H$315,C3,0),0))*(ROW($G$3:$G$315)-2)),IF(SUM(--(ISNUMBER(INDEX($G$3:$H$315,SUM((IFERROR(MATCH($G$3:$G$315,C3,0),0)+IFERROR(MATCH($H$3:$H$315,C3,0),0))*(ROW($G$3:$G$315)-2)),0)))),"BZ",""),"")

And the rows that illustrate the error:

COL:-------A--------||-------------------B-----------------------||-------------C-----------------||---D-------||---E---||----F----||------G----------||----------H---------------||
line9.JPG


line150.JPG


I see errors in the results eg. row 150 shows "BZ" in cell D, but row 9 cell G is blank.
Any ideas? Thanks very much for your help.
 
Upvote 0
Are you saying you tried to upload a xl2bb snippet of your worksheet and you recieved that error? That means you just need to make your selection of cells to post smaller.

As far as the error in 150. what value is in the cell for Berc ID where Memp ID is 14? Is it a calculated "" or a truly blank cell?
 
Upvote 0
Yes I received the error trying to upload a selection, and the selection was the minimum that included the error I posted (150 rows).
The cell in line 150 Berc ID is not calculated. How can I check if it's a truly blank cell?
 
Upvote 0
There is a function.
Excel Formula:
=ISBLANK(cellreference)

of course, the formula i suggested could be wrong. As that scenario was not tested.
 
Upvote 0
When I try ISBLANK in the cell I receive a "0" before checking its blank.
Could you try ISNUMERIC and > 0?
Also if the first check is if both fields G & H are numeric and > 0 then look for a MATCH?
Sorry I don't feel qualified to do this myself
 
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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