I have a bunch of URLs in a column like below:
https://www.example.com/xx/yy/product-name-could-be-30238543/
https://www.example.com/xx/yy/product-name-might-70293274/
https://www.example.com/xx/yy/product-name-may-40242653/
I wish to extract the ID's from the id but not with the last / in them. The right function gives me below:
40242653/ but i wish to get rid of the ID's too within the same function so can someone suggest a way?
Otherwise, i have to use another replace function separately to get rid of ending trailing slashes.
Thanks,
If all the IDs have 8 numerals, then you can use:
=LEFT(RIGHT(A1,9),8)
If they have more or less than 8 numerals, then ignore this answer.
I have found this to be easier to use (It extracts everything after the last occurrence of - in them.
SUBSTITUTE(RIGHT(A1;LEN(A1)-FIND("#";SUBSTITUTE(A1;"-";"#";(LEN(A1)-LEN(SUBSTITUTE(A1;"-";"")))/LEN("\"))));"/";"";1)
Related
I have a list of item numbers (100K) like this:
Some of the items have format like SAG571A-244-4 (thousands) which need to be filtered so I can delete them and only keep the items that have ONE hyphen per SKU. How can I isolate the items that have two instances of "-" in it's SKU? I'm open to solutions within Excel or using VBA as well.
Native text filters don't seem to be capable of this. I'm stumped.
As per John Coleman's comment, "*-*-*" can be used to isolate strings that have at least two dashes in them.
I would add that if you're entering them as a custom text filter, you should lose the double quotes (so just *-*-*) as otherwise the field seems to interpret the quotes literally.
Seems to work for me.
If you want just an excel formula to verify this and give you a result of the number of hyphens (0, 1, or 2+), here is one:
=IF(ISERROR(SEARCH("-",A1)),"0",IF(ISERROR(SEARCH("-",A1,IFERROR(SEARCH("-",A1)+1,LEN(A1)))),"1","2+"))
Replace A1 with your relevant column, then fill down. This is kind of a terrible way to do this performance wise, but you avoid using VBA and possibly xlsm files.
The code first checks to see if there is one hyphen, then if there is it checks to see if there is another hyphen after the position the first one was found. Looking for multiple hyphens in this manner is cumbersome and I don't recommend it.
I'm trying to bring back one of two possible words (Local or National) from a text string, and if neither of these words are in the text string, then bring back the string in the whole cell
The issue I have is that I can bring back either word when they appear, but I get an error when they do not
I'm currently using
=IFERROR(IF(SEARCH("*local*",B2,1),"Local"),IF(SEARCH("*national*",B2,1),"National"))
However this obviously this doesn't bring back if the words not exist
I'm sure it's easy and I'm missing something, but I just cannot figure it out. any help would be great
Cheers all
You can use:
Formula in B1:
=IF(ISNUMBER(SEARCH("*local*",A1)),"Local",IF(ISNUMBER(SEARCH("*national*",A1)),"national",A1))
Drag down
Note:
Notice that your wildcards make it that even a string with 'international' in it will return 'national'. If this is not what you want, you should remove the wildcards.
You can also use INDEX/AGGREGATE:
=IFERROR(INDEX({"local","national"},AGGREGATE(15,7,ROW($1:$2)/(ISNUMBER(SEARCH({"local";"national"},A1))),1)),A1)
This will allow one to replace the both hard coded arrays with a range of cells that contain the outputs. If Local and National were in D1:D2 then you can use:
=IFERROR(INDEX($D:$D,AGGREGATE(15,7,ROW($D$1:$D$2)/(ISNUMBER(SEARCH($D$1:$D$2,A1))),1)),A1)
That way if the list gets bigger the formula does not.
I'd suggest regular expressions.
=IF(REGEXMATCH(A2,"(Local|National)"),REGEXEXTRACT(A2,"(Local|National)"),A2)
I have a column (F) full of 11 digit numbers, what I need is to split them like the following: 12,345,6789,00
I have the following formula which adds a comma after the first two digits however I don't know how to get it to add them in after the next 3 then 4.
=LEFT(F2,2)&","&MID(F2,3,LEN(F2))
The above formula outputs like this: 12,345678900
Any suggestions?
Have you considered using the TEXT function? This is simple and would do the trick:
=TEXT(F2,"00"",""000"",""0000"",""00")
Use MID all the way:
=MID(F2,1,2)&","&MID(F2,3,3)&","&MID(F2,6,4)&","&MID(F2,10,2)
=left(F2,2)&","&mid(F2,3,3)&","&mid(F2,6,4)&","&right(F2,2)
Will give you what you want.
=LEFT(F2,2) &","&MID(F2,3,3)&","&MID(F2,6,4)&","&RIGHT(F2,2)
Try using the Text to Columns function in the Data Tab of Excel. It will allow you to split the numbers based on number of digits. For this to work though, it needs to be the case that the number ALWAYS has 11 digits... otherwise some numbers will get cut in the wrong spot.
You can then Concotenate them back together with Commas inbetween.
I have a column in my Excel file which contains different values. All these values begin with a letter and continues with a number.
I would like to know how to remove that letter and obtain only the number. Keep in mind that each value can have a different length.
Thanks
You can use something like this
=MID(A1,2,LEN(A1)-1)
you could do it with
=SUBSTITUTE(A1,LEFT(A1),"")
or
=RIGHT(A1,LEN(A1)-1)
There are countless ways to do that...
use simple function in excel itself
=left(cellname,no. of charcters)
=left(A1,8) will give only first left characters and same can be used right/mid
Seems like it would be a simple thing really (and it may be), but I'm trying to take the string data of a column and then through a calculated column, replace all the spaces with %20's so that the HTML link in the workflow produced email will actually not break off at the first space.
For example, we have this in our source column:
file:///Z:/data/This is our report.rpt
And would like to end up with this in the calculated column:
file:///Z:/data/This%20is%20our%20report.rpt
Already used the REPLACE, and made up a ghastly super nested REPLACE/SEARCH version, but the problem there is that you have to nest for EACH potential space, and if you don't know how many up front, it doesn't work, or will miss some.
Have any of you come across this scenario and how did you handle it?
Thanks in advance!
As far as I know there is no generic solution using the calculated-column syntax. The standard solution for this situation is using an ItemAdded (/ItemUpdated) event and initializing the field value from code.
I was able to solve this issue for my circumstances by using a series of calculated columns.
In the first calculated column (C1) I entered a formula to remove the first space, something like this:
=IF(ISNUMBER(FIND(" ",[Title])),REPLACE([Title],FIND(" ",[Title]),1,"%20"),[Title])
In the second Calculated column (C2) I used:
=IF(ISNUMBER(FIND(" ",[C1])),REPLACE([C1],FIND(" ",[C1]),1,"%20"),[C1]).
In my case, I wanted to encode upto four spaces, so I used 3 calculated columns (C1, C2, C3) in the same fashion and got the desired result.
This is not as efficient as using a single calculated column, but if SUBSTITUTE will not work in your SharePoint environment, and you cannot use an event handler or workflow, it may offer a workable alternative.
I actually used a slightly different formula, but it was on a work machine to which I don't have access at the moment, so I just grabbed this formula from a similar S.O. question. Any formula that will replace the first occurrence of a space with "%20" will work, the trick is to a) make sure the formula returns the original string unchanged if it does not have more spaces in it, and b) test, test, test. Create a view of your list that has the field you are trying to encode, plus the calculated fields, and see if you are getting the results you want.
so that the HTML link in the workflow produced email will actually not break off at the first space.
The browser only does this if you have not enclosed your link in quotes
If you wrap the link in quotes, it does not cut off at the first space
In a SharePoint Formula it would be:
="""file:///Z:/data/This is our report.rpt"""
becuase two quotes are the SP escape notation to output a quote
You can use this formula (Start trim for 1, in my case was 4):
=IF(ISBLANK([EUR Amount]),"",(TRIM(MID([EUR Amount],4,2))&TRIM(MID([EUR Amount],6,2))&TRIM(MID([EUR Amount],8,2))&TRIM(MID([EUR Amount],10,2))&TRIM(MID([EUR Amount],12,2))&TRIM(MID([EUR Amount],14,2)))*1)