Function not giving me right output

vmjan02

Well-known Member
Joined
Aug 15, 2012
Messages
1,132
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
I have this but not giving me correct results.


Golden Automation Report V1.xlsm
BCDEFGH
1MACAddressAddressInterfaceFlagsMAC AddressActual Outpiut
202:00:00:00:00:0410.0.0.4em1.0none0200-0-00-0-040200-0000-0004
332:b6:4f:16:3e:1710.129.4.1ae2.5none32b6-4-16-e-1732b6-4f16-3e17
442:71:83:72:10:3610.129.4.19ae3.5none4271-8-72-0-364271-8372-1036
532:b6:4f:16:3e:1710.129.4.81ae2.4none32b6-4-16-e-1732b6-4f16-3e17
642:71:83:72:10:3610.129.4.99ae3.4none4271-8-72-0-36
732:b6:4f:16:3e:1410.188.170.1fxp0.0none32b6-4-16-e-14
842:71:83:72:10:3410.188.170.2fxp0.0none4271-8-72-0-34
900:00:5e:00:01:5a10.188.170.3fxp0.0none0000-5-00-1-5a
107c:e2:ca:94:17:c110.188.170.4fxp0.0none7ce2-c-94-7-c1
1184:c1:c1:5f:7c:f910.188.170.5fxp0.0none84c1-c-5f-c-f9
127c:25:86:0e:ee:c610.188.170.6fxp0.0none7c25-8-0e-e-c6
137c:25:86:0e:ee:c610.188.170.7fxp0.0none7c25-8-0e-e-c6
142c:21:31:09:d1:4310.188.170.8fxp0.0none2c21-3-09-1-43
1530:b6:4f:0d:d2:ad10.188.170.9fxp0.0none30b6-4-0d-2-ad
162c:21:31:09:d1:4310.188.170.10fxp0.0none2c21-3-09-1-43
1700:a0:a5:8a:6d:9a10.188.170.11fxp0.0none00a0-a-8a-d-9a
1800:a0:a5:91:3b:b210.188.170.12fxp0.0none00a0-a-91-b-b2
1900:a0:a5:8a:6d:9a10.188.170.13fxp0.0none00a0-a-8a-d-9a
2000:a0:a5:8a:85:2610.188.170.14fxp0.0none00a0-a-8a-5-26
2100:a0:a5:8a:6d:6210.188.170.15fxp0.0none00a0-a-8a-d-62
2200:a0:a5:8a:85:2610.188.170.16fxp0.0none00a0-a-8a-5-26
2300:a0:a5:8a:55:6810.188.170.17fxp0.0none00a0-a-8a-5-68
2400:a0:a5:8a:48:8610.188.170.18fxp0.0none00a0-a-8a-8-86
2500:a0:a5:8a:48:8610.188.170.19fxp0.0none00a0-a-8a-8-86
2600:a0:a5:8a:48:2610.188.170.20fxp0.0none00a0-a-8a-8-26
2700:a0:a5:8a:47:7a10.188.170.21fxp0.0none00a0-a-8a-7-7a
Juniper INTMAC Agg













VBA Code:
Sub JuniperINTMACWorking()

Sheets("Juniper INTMAC Agg").Select
Range("g1").Value = "MAC Address"
   
With Worksheets("Juniper INTMAC Agg")
    With .Range("G2:G" & .Range("A" & .Rows.count).End(xlUp).Row)
        .Formula = "=IF(ISERR(FIND("":"", B2)), SUBSTITUTE(TEXT(SUBSTITUTE(MID(B2,1,2)&MID(B2,4,2)&MID(B2,7,2)&MID(B2,10,2)&MID(B2,13,2)&MID(B2,16,2), "":"" ,""-""),""0000-0000-0000""), ""-0"", ""-""), TEXT(SUBSTITUTE(MID(B2,1,2)&MID(B2,4,4)&MID(B2,9,4)&MID(B2,14,4), "":"" ,""-""), ""0000-0000-0000""))"
        .Value = .Value
    End With
End With


   

End Sub
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
What version(s) does it need to work on?

Unless there are variations of input that you have not shown, I would have thought:

Excel Formula:
=SUBSTITUTE(LEFT(B2,5)&"-"&MID(B2,7,5)&"-"&RIGHT(B2,5),":","")

would suffice.
 
Upvote 0
Solution

Forum statistics

Threads
1,223,886
Messages
6,175,191
Members
452,616
Latest member
intern444

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