IS there VBA code to Data compare and result in another col

JMC57

Board Regular
Joined
Apr 24, 2012
Messages
118
=IF(COUNTIF($A$2:$A$7,C2)>0,B2,"")</PRE>
The problem is that the value that is being place in the cell is not the correct value. In this case NIMOOC30 is in A2 and the value associated with NIMOOC30 in B2 is 6. Hoever the value returned in D8 for NIMOOC30(C8) is 4. I need it to be 6
<TABLE style="WIDTH: 350pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=466 border=0><COLGROUP><COL style="WIDTH: 102pt" width=136><COL style="WIDTH: 102pt" width=136><COL style="WIDTH: 73pt; mso-width-source: userset; mso-width-alt: 3547" span=2 width=97><TBODY><TR style="HEIGHT: 51.75pt" height=69><TD class=xl68 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 102pt; BORDER-TOP-COLOR: #d4d0c8; HEIGHT: 51.75pt; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=136 height=69>Exported Med ID Data Source 1</TD><TD class=xl70 id=td_post_3133491 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 102pt; BORDER-TOP-COLOR: #d4d0c8; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=136>Exported Med ID Data Source 1 Number of Times Not Availle able </TD><TD class=xl65 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 73pt; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: #9999ff" width=97>Med ID- </TD><TD class=xl65 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext 0.5pt solid; BORDER-LEFT-COLOR: windowtext; WIDTH: 73pt; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: #9999ff" width=97>Matched Result From Col B to Med Id in C</TD></TR><TR style="HEIGHT: 27.75pt" height=37><TD class=xl69 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 102pt; BORDER-TOP-COLOR: #d4d0c8; HEIGHT: 27.75pt; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=136 height=37>NIMOOC30</TD><TD class=xl71 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 102pt; BORDER-TOP-COLOR: #d4d0c8; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=136>6</TD><TD class=xl67 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 73pt; BORDER-TOP-COLOR: #d4d0c8; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=97>REFR</TD><TD class=xl73 style="BORDER-RIGHT: #3867a6 1pt solid; BORDER-TOP: #3867a6 1pt solid; BORDER-LEFT: #3867a6 1pt solid; BORDER-BOTTOM: #3867a6 1pt solid; BACKGROUND-COLOR: transparent">


</TD></TR><TR style="HEIGHT: 40.5pt" height=54><TD class=xl67 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 102pt; BORDER-TOP-COLOR: #d4d0c8; HEIGHT: 40.5pt; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=136 height=54>DIPRVIAL</TD><TD class=xl71 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 102pt; BORDER-TOP-COLOR: #d4d0c8; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=136>5</TD><TD class=xl67 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 73pt; BORDER-TOP-COLOR: #d4d0c8; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=97>DIPRVIAL</TD><TD class=xl73 style="BORDER-RIGHT: #3867a6 1pt solid; BORDER-LEFT: #3867a6 1pt solid; BORDER-TOP-COLOR: #3867a6; BORDER-BOTTOM: #3867a6 1pt solid; BACKGROUND-COLOR: transparent">5.00


</TD></TR>


<TR style="HEIGHT: 40.5pt" height=54><TD class=xl69 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 102pt; BORDER-TOP-COLOR: #d4d0c8; HEIGHT: 40.5pt; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=136 height=54>MS2</TD><TD class=xl71 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 102pt; BORDER-TOP-COLOR: #d4d0c8; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=136>5</TD><TD class=xl67 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 73pt; BORDER-TOP-COLOR: #d4d0c8; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=97>POTAPIGG</TD><TD class=xl73 style="BORDER-RIGHT: #3867a6 1pt solid; BORDER-LEFT: #3867a6 1pt solid; BORDER-TOP-COLOR: #3867a6; BORDER-BOTTOM: #3867a6 1pt solid; BACKGROUND-COLOR: transparent"></TD></TR><TR style="HEIGHT: 27.75pt" height=37><TD class=xl67 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 102pt; BORDER-TOP-COLOR: #d4d0c8; HEIGHT: 27.75pt; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=136 height=37>OSMIIL20 1</TD><TD class=xl71 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 102pt; BORDER-TOP-COLOR: #d4d0c8; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=136>5</TD><TD class=xl67 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 73pt; BORDER-TOP-COLOR: #d4d0c8; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=97>PANT40I</TD><TD class=xl73 style="BORDER-RIGHT: #3867a6 1pt solid; BORDER-LEFT: #3867a6 1pt solid; BORDER-TOP-COLOR: #3867a6; BORDER-BOTTOM: #3867a6 1pt solid; BACKGROUND-COLOR: transparent"></TD></TR><TR style="HEIGHT: 40.5pt" height=54><TD class=xl67 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 102pt; BORDER-TOP-COLOR: #d4d0c8; HEIGHT: 40.5pt; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=136 height=54>RAPID INTUBATION</TD><TD class=xl71 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 102pt; BORDER-TOP-COLOR: #d4d0c8; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=136>5</TD><TD class=xl67 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 73pt; BORDER-TOP-COLOR: #d4d0c8; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=97>ZOSY50FR2</TD><TD class=xl73 style="BORDER-RIGHT: #3867a6 1pt solid; BORDER-LEFT: #3867a6 1pt solid; BORDER-TOP-COLOR: #3867a6; BORDER-BOTTOM: #3867a6 1pt solid; BACKGROUND-COLOR: transparent"></TD></TR><TR style="HEIGHT: 27.75pt" height=37><TD class=xl67 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 102pt; BORDER-TOP-COLOR: #d4d0c8; HEIGHT: 27.75pt; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=136 height=37>KEPP500T</TD><TD class=xl71 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 102pt; BORDER-TOP-COLOR: #d4d0c8; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=136>4</TD><TD class=xl67 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 73pt; BORDER-TOP-COLOR: #d4d0c8; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=97>ACETOL130</TD><TD class=xl73 style="BORDER-RIGHT: #3867a6 1pt solid; BORDER-LEFT: #3867a6 1pt solid; BORDER-TOP-COLOR: #3867a6; BORDER-BOTTOM: #3867a6 1pt solid; BACKGROUND-COLOR: transparent"></TD></TR><TR style="HEIGHT: 27.75pt" height=37><TD class=xl67 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 102pt; BORDER-TOP-COLOR: #d4d0c8; HEIGHT: 27.75pt; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=136 height=37>RIFAX200T</TD><TD class=xl71 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 102pt; BORDER-TOP-COLOR: #d4d0c8; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=136>4</TD><TD class=xl67 style="BORDER-LEFT-COLOR: #d4d0c8; BORDER-BOTTOM-COLOR: #d4d0c8; WIDTH: 73pt; BORDER-TOP-COLOR: #d4d0c8; BACKGROUND-COLOR: transparent; BORDER-RIGHT-COLOR: #d4d0c8" width=97>NIMOOC30</TD><TD class=xl73 style="BORDER-RIGHT: #3867a6 1pt solid; BORDER-LEFT: #3867a6 1pt solid; BORDER-TOP-COLOR: #3867a6; BORDER-BOTTOM: #3867a6 1pt solid; BACKGROUND-COLOR: transparent">4.00</TD></TR></TBODY></TABLE>
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
If you are using a Countif for only values greater than zero could you not use Index/Match with error checking (or conditional formatting the #N/A out)?

Excel Workbook
ABCDIL
1Exported Med ID Data Source 1Exported Med ID Data Source 1 Number of Times Not Availle ableMed ID-Matched Result From Col B to Med Id in C2007-10
2NIMOOC306REFR  
3DIPRVIAL5DIPRVIAL555
4MS25POTAPIGG  
5OSMIIL20 15PANT40I  
6RAPID INTUBATION5ZOSY50FR2  
7KEPP500T4ACETOL130  
8RIFAX200T4NIMOOC30466
Sheet2
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
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