Delete row if both cells contain the same root URL - excel

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://","")&"/"))

Related

Can I format an Excel column to be a hyperlink based on the text I enter?

I've got a bunch of hyperlinks that only vary by a number at the end, such as:
https://somesite.com/but/the_URL_is&20%QUITE_LONG/query?1234
https://somesite.com/but/the_URL_is&20%QUITE_LONG/query?9876
https://somesite.com/but/the_URL_is&20%QUITE_LONG/query?57483
https://somesite.com/but/the_URL_is&20%QUITE_LONG/query?13543
Is there a way to apply formatting to the column so that I only have to put in the number for the cell value, (1234) and it formats it to be a hyperlink to the URL?
I'm not clear on what you want to show in your display (the long URL or just the number). Here's a way to do both:
Cell C2 formula:
=HYPERLINK(CONCAT($A$2,B2))
Or if you want to show just the number, then add a friendly name in the formula, such as cell C6 formula:
=HYPERLINK(CONCAT($A$2,B6),B6)
Edit
After posting, I just realized you asked if you could "format". I guess my answer is not sufficient and I could therefore remove it if it does not address your question.

If Cell is blank add SUM of another

If a cell in TT[Fiscal Law 301 CBT] is blank i would like to add the numbers in TT[Helper1]
CountBlank doesnt work because I need to sum of column TT[Helper]. Other issues i've tried is counting the number of "" but it always brings back zero.
Please help...
use the following formula
=IF(TT[Fiscal Law 301 CBT]="", TT[Helper1],TT[Fiscal Law 301 CBT])
you would need to generate another table filled with this formula that would check fiscal law for a blank value. when there is a blank it pulls from helper1, and when there is no blank it pulls the value from fiscal law. Normally I would be referencing individual cell address like D2, so there may be an issue with the table referencing method which I am not familiar with.

In Excel, need to populate a cell with a value based on multiple conditions in corresponding table

I am editing this entire thing because I feel I can be more clear now, and I think this question can be very useful for a lot of people:
Original image here: http://i.imgur.com/Givg96T.png?1[/img]
I guess I can't post a picture, so here is a link to what I am referencing.
Based on the shown formula, Cell D1 says compliant because it found the referenced text (B1) in the cited range column (D). This is fine, I get how to do this part. The problem is that I want it to say compliant only if it finds that text, which it did, AND ALSO has a Y next to that particular cell in column G, not a N as shown. So ideally it would say 'not sufficient' rather than compliant, because although it found the next, there is an N next to it, not a Y. This needs to apply to a range and not just one row as there will be many rows of this same data.
Essentially the question I want cell D1 to answer is this: Do you find anything that says the contents of cell B1 in column D? And if so, is there a Y next to it in column G? If the answer is yes to both of those questions, say "compliant". If not, say 'Not sufficient'.
Thank you to anyone who can offer any advice, I greatly appreciate it.
You need to use IF and AND both in this case.
You can try the formula (assuming value starts from row 1):
=IF(AND(F1="international stock",G1="Y"),"Yes","No")
Put it in cell H1 and drag to the end of rows in column H.
For the demo purpose I have put "Local stock" as well.
Hers is the screenshot.
-----------------------------------------------------------------------------------------------
EDIT (Based on comment):
-----------------------------------------------------------------------------------------------
So in order to search in whole column, you will first have to create a name range for column F and G so it will make your life easier.
Formulas -> Name Manager -> Create new -> give name RngF (for column F) and give the formula:
=OFFSET(Sheet1!$F$1,0,0,COUNTA(Sheet1!$F:$F),1)
Same way create another and give a name RngG and give formula:
=OFFSET(Sheet1!$G$1,0,0,COUNTA(Sheet1!$G:$G),1)
You may need to change the "Sheet Name".
Then you will combine IF, AND, MATCH, INDEX formulas and Array to get what you want.
Basically,
MATCH will tell you the cell number if "International stock" is present in column F.
INDEX will give you the cell value based on the references.
And in final formula, you will combine them altogether like this:
=IF(AND(MATCH("International stock",RngF,0)>0,INDEX(RngG,MATCH("International stock",RngF,0))="Y"),"Yes","No")
Make sure you hit Ctrl + Shift + Enter. This will make the formula to run in entire array that you've passed using name range. So it should look something like:
{=IF(AND(MATCH("International stock",RngF,0)>0,INDEX(RngG,MATCH("International stock",RngF,0))="Y"),"Yes","No")}

search multiple columns for a value and concatenate the address of the cells

I have been breaking my head over this formula for sometime now. I have found a solution which is too big and not so convenient to use every time. So can any Excel Expert give me a solution/suggestion?
Column A contains 150 values. Column D to R contains a table in which I need to look up the values in A one by one. I want to return address of all the cells that contains the value.
For example, Value in A2 is present in cells D5, E15, H10, R3 then my result should be D5,E15,H10,R13.
Please Note that some columns may not contain the value of A2, I do not want them displayed.
Here is the formula I have written:
=CONCATENATE(
IF(A2=IF(COUNTIF(D:D,A2),VLOOKUP(A2,D:D,1,FALSE),""),ADDRESS(MATCH(A2,D:D,0),4,4),0),",",
IF(A2=IF(COUNTIF(E:E,A2),VLOOKUP(A2,E:E,1,FALSE),""),ADDRESS(MATCH(A2,E:E,0),5,4),0),",",
IF(A2=IF(COUNTIF(F:F,A2),VLOOKUP(A2,F:F,1,FALSE),""),ADDRESS(MATCH(A2,F:F,0),6,4),0),",",
IF(A2=IF(COUNTIF(G:G,A2),VLOOKUP(A2,G:G,1,FALSE),""),ADDRESS(MATCH(A2,G:G,0),7,4),0),",",
IF(A2=IF(COUNTIF(H:H,A2),VLOOKUP(A2,H:H,1,FALSE),""),ADDRESS(MATCH(A2,H:H,0),8,4),0),",",
IF(A2=IF(COUNTIF(I:I,A2),VLOOKUP(A2,I:I,1,FALSE),""),ADDRESS(MATCH(A2,I:I,0),9,4),0),",",
IF(A2=IF(COUNTIF(J:J,A2),VLOOKUP(A2,J:J,1,FALSE),""),ADDRESS(MATCH(A2,J:J,0),10,4),0),",",
IF(A2=IF(COUNTIF(K:K,A2),VLOOKUP(A2,K:K,1,FALSE),""),ADDRESS(MATCH(A2,K:K,0),11,4),0),",",
IF(A2=IF(COUNTIF(L:L,A2),VLOOKUP(A2,L:L,1,FALSE),""),ADDRESS(MATCH(A2,L:L,0),12,4),0),",",
IF(A2=IF(COUNTIF(M:M,A2),VLOOKUP(A2,M:M,1,FALSE),""),ADDRESS(MATCH(A2,M:M,0),13,4),0),",",
IF(A2=IF(COUNTIF(N:N,A2),VLOOKUP(A2,N:N,1,FALSE),""),ADDRESS(MATCH(A2,N:N,0),14,4),0),",",
IF(A2=IF(COUNTIF(O:O,A2),VLOOKUP(A2,O:O,1,FALSE),""),ADDRESS(MATCH(A2,O:O,0),15,4),0),",",
IF(A2=IF(COUNTIF(P:P,A2),VLOOKUP(A2,P:P,1,FALSE),""),ADDRESS(MATCH(A2,P:P,0),16,4),0),",",
IF(A2=IF(COUNTIF(Q:Q,A2),VLOOKUP(A2,Q:Q,1,FALSE),""),ADDRESS(MATCH(A2,Q:Q,0),17,4),0),",",
IF(A2=IF(COUNTIF(R:R,A2),VLOOKUP(A2,R:R,1,FALSE),""),ADDRESS(MATCH(A2,R:R,0),18,4),0))
As I said, this works but I am looking for a simpler and smaller formula.
Hint: Maybe using array can help?
Thanks in advance :)
What you are trying to accomplish is not a great fit for Excel formulas, but it can be done with a smaller, simpler formula dragged across 15 columns instead of 1 giant complicated formula that tries to do everything at once.
Assuming column A has 150 values (from A1 to A150), and there is a table going from D1 to R50...
Enter =S1&IFERROR(","&ADDRESS(MATCH($A1,D$1:D$50,0),COLUMN(D1)),"") into T1.
Drag the formula across to AH1.
Enter =RIGHT(AH1,LEN(AH1)-1) into AI1.
Select T1 to AI150 and press Ctrl-D.
Column AI1 will contain the results you are looking for.
How does this work?
The formula in T1 begins by taking the result of one cell to the left (which is blank). Then it concatenates this with the address of the first match in column D (prefixed by a comma). If there is no match, it just concatenates blank (""). As you drag this formula to the right, it keeps concatenating addresses as matches come up (or blank if there are none). When you get to the end, you will have looked for matches in all 15 column of your table.
The formula in AI1 just strips off the initial comma if there is one.

How to combine vlookup and hyperlink function?

I am trying to have the values that my vlookup function returns act as a hyperlink that will go to the value it pulled from another sheet in the same workbook.
There are thousands of lines that I need to hyperlink and I can't go one by one, right clicking and manually changing them.
If anyone has advice to solve this problem, please let me know. Below is my vlookp formula.
=VLOOKUP(A:A,'Cost Estimates'!A:C,3,FALSE)
To list address of the matching cell, you can do this:
=ADDRESS(MATCH(A1,'Cost Estimates'!A:A),3,1,1,"Cost Estimates")
But this won't create a hyperlink, just a visible address.
You can use:
=VLOOKUP(A1,'Cost Estimates'!A:C,3,FALSE)
to return the column C value corresponding to A1.
Then use:
=MATCH(VLOOKUP_RETURN,C:C,0)
to get the index of that in column C.
Then use:
="#'Cost Estimates'!C"&INDEX_VALUE
to build a hyperlink address.
Finally, you can use HYPERLINK to construct the hyperlink. Putting it all together in a single formula:
=HYPERLINK("#Cost Estimates!C"&MATCH(VLOOKUP(A1,'Cost Estimates'!A:C,3,FALSE),'Cost Estimates'!C:C,0),VLOOKUP(A1,'Cost Estimates'!A:C,3,FALSE))
Hope that does the trick.

Resources