dbecker215
New Member
- Joined
- Jun 22, 2014
- Messages
- 3
Hello,
I'm having an issue with converting different UPC string lengths to one common length. Basically the data teams in our company do not have a firm standard on UPC or UPC equivalent (for internal product identification) nor do our different software have the same database structure. What I need to do is create a VBA that converts identifiers with string lengths of 3 to 13 digits all to 13 digits by placing the appropriate number of "0"s in front of the given value. I have an excel function that I created, but I'm looking to create a user form that allows anyone to easily convert the data. The excel function is:
=IF(LEN(D36757)=3,"0000000000"&D36757,IF(LEN(D36757)=4,"000000000"&D36757,IF(LEN(D36757)=5,"00000000"&D36757,IF(LEN(D36757)=6,"0000000"&D36757,IF(LEN(D36757)=7,"000000"&D36757,IF(LEN(D36757)=8,"00000"&D36757,IF(LEN(D36757)=9,"0000"&D36757,IF(LEN(D36757)=10,"000"&D36757,IF(LEN(D36757)=11,"00"&D36757,IF(LEN(D36757)=12,"0"&D36757,IF(LEN(D36757)=13,D36757,"fix please")))))))))))
What vba syntax should I use to have this loop through an unknown amount of cells and either replace the value or place the value in the cell next to the original value.
Once I start working with sheets that have 100,000 rows of data the excel formula bogs down some of the computers when I need to also run vlookups from the same workbook.
Thank you,
I'm having an issue with converting different UPC string lengths to one common length. Basically the data teams in our company do not have a firm standard on UPC or UPC equivalent (for internal product identification) nor do our different software have the same database structure. What I need to do is create a VBA that converts identifiers with string lengths of 3 to 13 digits all to 13 digits by placing the appropriate number of "0"s in front of the given value. I have an excel function that I created, but I'm looking to create a user form that allows anyone to easily convert the data. The excel function is:
=IF(LEN(D36757)=3,"0000000000"&D36757,IF(LEN(D36757)=4,"000000000"&D36757,IF(LEN(D36757)=5,"00000000"&D36757,IF(LEN(D36757)=6,"0000000"&D36757,IF(LEN(D36757)=7,"000000"&D36757,IF(LEN(D36757)=8,"00000"&D36757,IF(LEN(D36757)=9,"0000"&D36757,IF(LEN(D36757)=10,"000"&D36757,IF(LEN(D36757)=11,"00"&D36757,IF(LEN(D36757)=12,"0"&D36757,IF(LEN(D36757)=13,D36757,"fix please")))))))))))
What vba syntax should I use to have this loop through an unknown amount of cells and either replace the value or place the value in the cell next to the original value.
Once I start working with sheets that have 100,000 rows of data the excel formula bogs down some of the computers when I need to also run vlookups from the same workbook.
Thank you,