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, [TABLE="width: 104"]
<tbody>[TR]
[TD="class: xl65, width: 104"]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[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
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,224,823
Messages
6,181,185
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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