Way to overcome Excel Vlookup function limit of 256 characters

前端 未结 3 1308
粉色の甜心
粉色の甜心 2020-12-14 04:16

I have a excel array with multiple values. Some are less than 256 characters and some have a length greater than 256.

When I tried to do a VLookup using a sample str

3条回答
  •  粉色の甜心
    2020-12-14 04:36

    I had the same problem and I've wrote this custom primitive vlookup. It doesn't care about the length of your cells' values.

    Function betterSearch(searchCell, A As Range, B As Range)
            For Each cell In A
                If cell.Value = searchCell.Value Then
                        betterSearch = B.Cells(cell.Row, 1)
                        Exit For
                End If
                betterSearch = "Not found"
            Next
    
    End Function
    

    PS Can't help but wonder why the original VLOOKUP written by professionals is implemented in this particular case more poorly than this 10-lined func?

提交回复
热议问题