I have a list of URLs in excel cells. The problem is that there are implicit duplicates:
http://www.example.com/
http://www.example.com
My idea is to strip the cells values of the "/". And then I'll be able to remove duplicates as usual.
Is there a way to remove trailing slashes if they exist? Preferrable way is to do it without VBA (by means of formulae).
You could try this either in other cells then check for duplicates, or you could integrate this formula directly in your method that is checking for duplicates :
=IF(RIGHT(A1;1)="/";LEFT(A1;LEN(A1)-1);A1)
URL Separators
Let's say the data is in column 'A' and starts in the first row put this formula into a cell in the first row e.g. B1, C1 ... :
=IF(A1="","",IF(RIGHT(A1,1)<>"/",A1,LEFT(A1,LEN(A1)-1)))
=IF(A1="","",...) - Checks if there is data in cell 'A1'. If there isn't the result is "".
... IF(Right(A1,1)<>"/",A1, ...) - Checks if the last character is not a "/". If it is not, A1 is used.
... Left(A1,Len(A1)-1) - The last character is '/' so the value (string) of A1 is shortened by one.
You know how to continue.
Related
How can I verify partial strings in cells across columns without having to look for an exact match?
I have a single spreadsheet with two columns that contain corresponding pairs of data in the form of text, or "strings". However, each corresponding pair almost matches except for a couple characters on the end. I need to make excel recognize the pairs despite the inexact string match, and return a "yes" or a "no" as to whether or not there a corresponding pair exists between the two columns. I want it to tell me "yes" or "no" in a single cell.
I do not want to delete characters from either column to make them match, they have to stay as they are.
My solution was that if I used an IF statement to determine whether A:A=B:B, all I would need to do is tell excel to also substitute the conflicting text characters with empty spaces, but that didn't work :( It returns #VALUE instead of a yes or no. I placed the function inside D1.
This is my formula:
=IF(SUBSTITUTE(A:A,"-Z","")*A:A=B:B,"Yes","No")
I think maybe I need a formula that will accomplish the following:
If a string with a length of up to 12 characters in a cell of column A matches another string in a cell of column B, return "true" in C2
I don't know what formula that would be. I would appreciate any help! Thanks in advance!
You can use this formula =IF(SUMPRODUCT(--(LEFT($A$2:$A$23,12)=LEFT(B2,12)))>0,"TRUE","FALSE"). It will first extract first 12 characters from strings in column A, then compare it to the first 12 characters in column B. Adjust range to your needs.
You can use VLOOKUP construct like below in cell C2 and then copy down:
=IF(ISNA(VLOOKUP(LEFT(A2,12)&"*",B:B,1,0)),"NO","YES")
I am using the formula:
=(INDEX($A$2:$A$300, MATCH(0, COUNTIF($B$1:B1, $A$2:$A$300), 0))
This takes a list of values from column A and reproduces it in column B to show each value only once, i.e. if a value is duplicated, it gets skipped.
For the most part it is working exactly as I hoped, however, some of the values in column A contain the wildcard character '?'.
Is it possible to get this formula to treat the '?' as just a standard character? Ideally I would like to include this rule in the formula itself rather than having to do a 'find and replace' with '~?'. Is this at all possible?
Many thanks
Change your formula to:
=(INDEX($A$2:$A$300,MATCH(0,COUNTIF($B$1:B1,SUBSTITUTE($A$2:$A$300,"?","~?")),0)))
confirmed with ctrl+shift+enter
This replaces the ? in the criteria array with ~? within your formula.
You need to "escape" those characters. This is done the same as when searching in Excel, by prepending them with the tilde character: ~
So this searches for the question mark:
=MATCH("~?",A1:A10,0)
I am new to Excel formulas. I am using this formula:
=INDEX(B$1:G$1,MATCH(H2,B2:G2,0))
It appends the corresponding column name, when values in a range of rows (B2:G2), match my target H2.
The problem with this is that when two equal values are found, the leftmost is appended, whereas I'd rather have the rightmost appended.
I would like to have the same thing, but performed the other way around (matching done from G2:B2).
Any suggestion?
Use this array formula:
=MAX(IF($B$2:$G$2=H2,COLUMN($B$2:$G$2)-COLUMN(INDEX($B$2:$G$2,1,1))+1))
Put it and press CTRL+SHIFT+ENTER together.
I want to add some values in my excel sheet , but when there is no value want hyphen instead of zero .
Here is my formula as below :
=IFERROR(SUMIF(A1:A6,"="&VLOOKUP($F$3,A1:B6,1,FALSE),B1:B6),"-")
The formula for that'd be:
=IFERROR(IF(SUMIF(A1:A6,"="&VLOOKUP($F$3,A1:B6,1,FALSE),B1:B6)=0,"-",SUMIF(A1:A6,"="&VLOOKUP($F$3,A1:B6,1,FALSE),B1:B6)),"-")
But I suspect you just want to change the number format to ACCOUNTING... it automatically replaces zeros with hyphens.
I have a two column spreadsheet.
In Column A I have one URL in Column B I have another URL.
I want to delete the entire row if both cells in the same row contain the same root domain.
Example:
Delete the following
Cell A1 = www.google.com
Cell B1 = www.google.com/randomsubpage/anothersubpage
Keep the following
Cell A1 = www.yahoo.com/randomsubpage/anothersubpage
Cell B1 = www.google.com/randomsubpage/anothersubpage
Is this possible? If it's possible outside of Excel, I'm also open to suggestions.
Thanks,
Sam
Place this formula in cell C1
=IF(LEFT(A1,FIND(".com",A1)+3)=LEFT(B1,FIND(".com",B1)+3),"Delete","")
Drag down the length of your data set.
Filter on Column C for Delete
Delete the filtered rows.
This assumes all your urls are ".com". If you have ".net" or ".gov" or whatever, as well, you'll need to find a more common string to lookup in the FIND function and adjust the positioning accordingly.
This formula will work for multiple url endings:
=IF(LEFT(A1,FIND(".",A1,FIND(".",A1)+1)+3)=LEFT(B1,FIND(".",B1,FIND(".",B1)+1)+3),"DELETE","")
I thought I should try and make it cope with http:// or https:// and possibly subdomains and domains like .tv but maybe I'm over-thinking it! Not sure whether www should be considered part of the URL, but haven't put that in at present:-
=LEFT(SUBSTITUTE(SUBSTITUTE(A1,"http://",""),"https://","")&"/",FIND("/",SUBSTITUTE(SUBSTITUTE(A1,"http://",""),"https://","")&"/"))
=LEFT(SUBSTITUTE(SUBSTITUTE(B1,"http://",""),"https://","")&"/",FIND("/",SUBSTITUTE(SUBSTITUTE(B1,"http://",""),"https://","")&"/"))