
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 12, 2022 12:29 PM
I am storing MAC addresses and we scan a bar code and in inputs the MAC address. The only thing with this is they don’t have the ‘-’. Is it possible to format it to have the - between every 2 characters? Also do I need to have 2 fields for this? The first being the scanned MAC address and the second being a formula? Or can I have a formula and input text then it formats it within the same field? Either way will work.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 12, 2022 01:28 PM
Hi @JPPSO_NC
This can probably be done with a regular expression much more elegantly that any formula I could come up with.
Yes, you will need a formula field, add this to it. Change Name to what ever field has the wrongly formatted address
LEFT(Name,2)&'-'&MID(Name,3,2)&'-'&MID(Name,5,2)&'-'&MID(Name,7, 2)&'-'&MID(Name,9,2)&'-'&RIGHT(Name,2)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 13, 2022 05:38 AM
This worked perfectly. Thanks.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 13, 2022 07:20 AM
I tested if this ca be done with REGEX and came up with this:
REGEX_REPLACE(
REGEX_REPLACE(Name, "(.{2})", "$1-"),
"-\\z",
""
)
^ That adds a -
at the end of every two characters, and removes an extra - at the end of the line if present.
