I'm stumped. I need Excel to look at the value in M2 and find an exact match in column K. When it finds an exact match in column K, I need it to copy the contents of the cell 3 to the right of the column K's match location.
I can get the value of the cell just to the right of M2, but I need it 3 right of the match on column K
=OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())),0,6)
I tried a script that did nothing
Sub FindMatch()'Declare variablesDim cellValue As StringDim cellAddress As String'Get the value in cell M2cellValue = Cells(2, 2).Value'Find the cell address of the first exact match for cellValue in column McellAddress = Application.Match(cellValue, Range("M:M"), 0)'If there is a match, put the cell address in cell H2If cellAddress <> 0 ThenCells(2, 3).Value = cellAddressEnd IfEnd Sub
I had an idea to put the cell reference in the cell and then try to copy the contents 6 cells to the right of the match
This did what I wanted and put the cell address of the match into the cell I have highligted
=ADDRESS(MATCH(M2,K:K,0),14)
However, I can't get it to copy the value of the cell, 5 columns to the right of the match.
=Cells(H2).offset(0,6).value
Any ideas?
=IF(Cells(2, 2).Value <> "", Cells(2, 2).Offset(0, 6).Value, "")=Cells(H2).Offset(0, 6).Value
Sub CopyCell()'Declare variablesDim cellValue As StringDim cellAddress As String'Get the value in cell H2cellValue = Cells(2, 2).Value'Get the cell address of the cell 6 columns to the right of H2cellAddress = Cells(2, 2).Offset(0, 6).Address'Copy the cell value to the new cellCells(cellAddress).Value = cellValueEnd Sub
=IF(MATCH(M2, K:K, 0) <> 0, ROW(MATCH(M2, K:K, 0)), "") & "," & COLUMN(MATCH(M2, K:K, 0))