Comparing cells

ccrique

New Member
Joined
Aug 26, 2022
Messages
4
Office Version
  1. 2010
Platform
  1. Windows
1661524329827.png

(see image above) I want to compare each cell in column B to the values in columns I and J. And if a cell in column B contains the same value as a cell in column I or J I want column D to give me the same value that I have in the cell in column K that is in the same row as the value in column I or J that matched with the cell in column B.

So as a result I want the following:

1661524436388.png


How di I make this happen ?
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Could use a small UDF as below:
VBA Code:
Function GetVal(str As String)
    GetVal = Cells(Range("I:J").Find(str, , , xlWhole).Row, 11).Value
End Function

And use it as below:
Book1
ABCDEFGHIJK
1
2Dave100Dave100
3Paul200Paul200
Sheet1
Cell Formulas
RangeFormula
C2:C3C2=GetVal(B2)
 
Upvote 0
Could use a small UDF as below:
VBA Code:
Function GetVal(str As String)
    GetVal = Cells(Range("I:J").Find(str, , , xlWhole).Row, 11).Value
End Function

And use it as below:
Book1
ABCDEFGHIJK
1
2Dave100Dave100
3Paul200Paul200
Sheet1
Cell Formulas
RangeFormula
C2:C3C2=GetVal(B2)
And what do I do if Dave or Paul show up more then ones in colums I and J. And I want column C( in your example ) to give me all the values of column k corresponding to the values in column I an J that macthed the values in column C?
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,606
Members
449,089
Latest member
Motoracer88

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