![]() |
#8
|
|||
|
|||
![]()
VBA and no lookup table
Code:
Sub Test_1() Dim rng As Range, cel As Range Dim startpoint As Long With Sheets("51batch") Set rng = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For Each cel In rng startpoint = InStrRev(cel, "_") + 2 'for test purposes write formula to column "K" cel.Offset(, 10) = "=Mid(" & cel.Address & "," & startpoint & ", 5)" Next cel End With End Sub Consulting my buddy Google lead to this array entered formula without any vba =MID(A2,FIND("~",SUBSTITUTE(A2,"_","~",(LEN(A2)-LEN(SUBSTITUTE(A2,"_","")))/LEN("_")))+2,5) I must confess I don't understand it but the establishing of where to find the last underscore comes from an old posting by the very knowledgeable Tom Ogilvy Last edited by NoSparks; 04-08-2020 at 11:39 AM. Reason: to add the formula part |
Tags |
paste formula lookup |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
LOOKUP Formula error but WHY??? | Haga | Excel | 1 | 04-17-2019 11:13 PM |
N/A Value in Lookup Formula | NickFazer | Excel | 2 | 04-02-2019 04:22 AM |
How to update lastname with the help of V-Lookup formula? | Mangesh1212 | Excel | 6 | 12-05-2018 02:15 AM |
Need help with lookup formula | tristanlau | Excel | 1 | 08-14-2017 07:16 AM |
![]() |
Mav | Excel Programming | 6 | 05-10-2015 08:42 PM |