need a reasonably easy UDF please

Jeffrey Green

Well-known Member
Joined
Oct 24, 2007
Messages
1,021
I deal with VINS all the time. Example,
3FA6P0G73HR402900. i need to parse that out and bring in position 5,6,7,8 and 10 into a new cell, preceded by "VIN".
I usually just enter ="VIN"&Mid(A1,5,4)&MiD(A1,10,1), to give me VINP0G7H.

(The VIN isnt always in column A . . . but it will be in the column one to the left)

That gets old, real quick. Any chance of getting a UDF for this? thanks a bunch . . .

Jeff

<tbody>
</tbody>
 
Last edited:

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Try

Code:
Public Function VIN(c As Range)
VIN = "VIN" & Mid(c, 5, 4) & Mid(c, 10, 1)
End Function
 
Upvote 0
Code:
Function vin(rng As Range)
vin = "VIN" & Mid(rng, 5, 4) & Mid(rng, 10, 1)
End Function


To use where A2 has the Vin number
Code:
=vin(A2)
 
Upvote 0
Make sure you put the code in a standard module (not in a sheet module)
In VBA window, click Insert - Module
 
Upvote 0

Forum statistics

Threads
1,216,526
Messages
6,131,187
Members
449,631
Latest member
mehboobahmad

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