saidhruv
Member
Dear All,
This query is about a specific string to be extracted from a full string within cell and thereby replacing that specific string back within the original string, i.e. within the same cell. Before this replacement, the extracted string would be manually appended with a specific code before it is fitted back within original string.
The explanation of query is very lengthy and i am really sorry about that.
The data that i have is a list of links which consists of . (dot) within the link. The output required is, replace the dot with specific code. However, this specific code is not generic, it changes based on where the dot is situated within the link. Example, NEWYORK. would have a html code for fullstop, hence output would be, NEWYORK'.. The other example is, p.t.o. In this case the dots will be replaced with html code of dot, i.e. p⋅t⋅o⋅
In this manner the application of whether dot is an html code ⋅ or ' would depend on situation and hence we cannot make a logic within formula/vba. The replacements have to be made manually.
But, what can be done is, LOGIC: extract the data just before the dot (along with the dot) and place it within a separate sheet. Manually one can replace the dot with specific code within that separate sheet. And finally the code to replace the extracted data back into the original sheet.
Now, a collegue of mine has already helped me in the case where the . are available within ADDRESS. However, we have another set of data that are a list of links. In this part the code available with us is not compatible. Hence we need help here.
Explaining the code that is compatible with ADDRESS. Have attached the file as well named DotCode.
Step1: Macro: MakeClean - this macro extracts data from within a pre-selected range. The data has the dot as well and is pasted in a separate sheet.
Step2: Manually replace the dots with specific code within that output available in separate sheet.
Step3: Macro: MultiReplace - this macro replaces the updated data within the original data, in a new sheet.
You may test this code. Please note that before manually replacing the dots as mentioned in step2, pls sort the output based on length of the data, large to small. This sorting is required as a workaround to overlook an existing bug within MultiReplace macro.
However, the macro that is required is as follows so as to extract data from LEFT of dot as per logic stated below:
Step1: remove all spaces available within the string. Please do not use TRIM cause we need to remove all spaces. This is required.
Step2: Extraction logic:
If punctuation (any special character) is available before dot, extract only that particular punctuation along with dot
.
If alphabet is available before dot, extract all alphabets till we get punctuation or integer or reach the start of cell..
If digit is available before dot, extract only that first digit just before dot and display along with dot
If . is available at the start, pls extract . along with the next set of data, i.e. if punctuation then only one punctuation, if word it should be extracted till it ends with punctuation or digit and if it is digit extract only that digit which is next to dot.
The above stated is the logic. Attaching the file LinkMakeClean. It has sheet link_example that has sample link data. The data is in column A and starts with A2.. Now, pls refer the other attachment DotCode. The macros available in this sample worksheet are required to be created with the logic stated above.
See if you can help cause we have tried almost many a times, but in vain.
Thanks!
This query is about a specific string to be extracted from a full string within cell and thereby replacing that specific string back within the original string, i.e. within the same cell. Before this replacement, the extracted string would be manually appended with a specific code before it is fitted back within original string.
The explanation of query is very lengthy and i am really sorry about that.
The data that i have is a list of links which consists of . (dot) within the link. The output required is, replace the dot with specific code. However, this specific code is not generic, it changes based on where the dot is situated within the link. Example, NEWYORK. would have a html code for fullstop, hence output would be, NEWYORK'.. The other example is, p.t.o. In this case the dots will be replaced with html code of dot, i.e. p⋅t⋅o⋅
In this manner the application of whether dot is an html code ⋅ or ' would depend on situation and hence we cannot make a logic within formula/vba. The replacements have to be made manually.
But, what can be done is, LOGIC: extract the data just before the dot (along with the dot) and place it within a separate sheet. Manually one can replace the dot with specific code within that separate sheet. And finally the code to replace the extracted data back into the original sheet.
Now, a collegue of mine has already helped me in the case where the . are available within ADDRESS. However, we have another set of data that are a list of links. In this part the code available with us is not compatible. Hence we need help here.
Explaining the code that is compatible with ADDRESS. Have attached the file as well named DotCode.
Step1: Macro: MakeClean - this macro extracts data from within a pre-selected range. The data has the dot as well and is pasted in a separate sheet.
Step2: Manually replace the dots with specific code within that output available in separate sheet.
Step3: Macro: MultiReplace - this macro replaces the updated data within the original data, in a new sheet.
You may test this code. Please note that before manually replacing the dots as mentioned in step2, pls sort the output based on length of the data, large to small. This sorting is required as a workaround to overlook an existing bug within MultiReplace macro.
However, the macro that is required is as follows so as to extract data from LEFT of dot as per logic stated below:
Step1: remove all spaces available within the string. Please do not use TRIM cause we need to remove all spaces. This is required.
Step2: Extraction logic:
If punctuation (any special character) is available before dot, extract only that particular punctuation along with dot
.
If alphabet is available before dot, extract all alphabets till we get punctuation or integer or reach the start of cell..
If digit is available before dot, extract only that first digit just before dot and display along with dot
If . is available at the start, pls extract . along with the next set of data, i.e. if punctuation then only one punctuation, if word it should be extracted till it ends with punctuation or digit and if it is digit extract only that digit which is next to dot.
The above stated is the logic. Attaching the file LinkMakeClean. It has sheet link_example that has sample link data. The data is in column A and starts with A2.. Now, pls refer the other attachment DotCode. The macros available in this sample worksheet are required to be created with the logic stated above.
See if you can help cause we have tried almost many a times, but in vain.
Thanks!