Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > The IT Pro > Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Programming A discussion forum for programs and programming used in tech-related businesses.

Reply
 
LinkBack Thread Tools
Old 10-26-2009, 03:39 PM   #1 (permalink)
Registered User
 
Join Date: Oct 2009
Posts: 1
OS: xp


Spreadsheet Fun

Sorry if this is the wrong forum for this, I can't find one that fits it better.

Firstly, hello every one, I am new here. I have encountered a little conundrum.

Alrighty, so I have a .csv spreadsheet which is one column of data; web addresses, in the following format.
Quote:
"http://personal-finance-software-review.toptenreviews.com/"
"http://personal-finance-software-review.toptenreviews.com/microsoft-money-deluxe-review.html"
"http://www.washingtonpost.com/wp-dyn/content/article/2009/07/17/AR2009071703851.html"
"http://news.cnet.com/8301-13860_3-10261742-56.html"
"http://www.christianpf.com/best-free-personal-finance-software/"
"http://www.getrichslowly.org/blog/2009/07/01/good-bye-microsoft-money-16-powerful-personal-finance-programs/"
"http://www.mint.com/"
"http://www.mybanktracker.com/bank-news/2009/08/10/top-5-personal-finance-software-that-helps-to-save-money/"
there are over 2000 entries. I would like to parse through these entries and find

A) The actual addresses that are most common (www.x.com/blablabla.html)

B) The domains that are most common (www.x.com)

Any ideas on how to do this quickly and efficiently?

Last edited by SpicyCrab; 10-26-2009 at 03:40 PM. Reason: typo
SpicyCrab is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 11-22-2009, 01:18 AM   #2 (permalink)
Registered User
 
Join Date: Sep 2009
Posts: 13
OS: windows xp


Re: Spreadsheet Fun

I copied the urls WITHOUT DOUBLE QUOTE in column A from A1 down.

Then I wrote a few macros and combined them in one overall macro.
the macros are given below
the macro is using splitting the url by text to columns and copied from column B to right.
Then the macro finds out the no. of occasions each text occurs and find out the max no. of occurrence and that is the common occurrence you can go throug the macros to follow my logic.

I AM NOT SURE WHETHER THIS IS QUICK OR EFFICIENT. But it seems to work

assumptions
1. The splitting(text to columns) of the url does not run more than the column I as I am doing something in column J in the "sub" macro "findcommondomain".
2. when urls are entered in A1 down there should not be any gap and the url entries should not have the double quotes
IT IS ENOUsGH IF you RUN THE MACRO "macrooverall". Other sub macro must be in the vbeditor in the same module.

If there is any bug post the code line where there is trouble and the error message.

The macros are

Code:
Sub findcommonurl()
Dim j As Integer, k As Integer, r As Range
Dim m(1 To 8) As Integer, x As String, y(1 To 8) As String
Dim z
j = Range("A1").End(xlDown).Row
Set r = Range(Range("A1"), Range("A1").End(xlDown))
For k = 1 To j
x = Cells(k, "A").Value
m(k) = WorksheetFunction.CountIf(r, x)
'MsgBox m(k)
y(k) = x
Next k
z = WorksheetFunction.Max(m)
MsgBox "common url is " & " " & y(z)
End Sub
Code:
Sub texttocolA()
Dim r As Range
Set r = Range(Range("A1"), Range("A1").End(xlDown))
r.TextToColumns Destination:=Range("B1"), DataType:=xlFixedWidth, _
        OtherChar:="/", FieldInfo:=Array(Array(0, 1), Array(7, 1)), _
        TrailingMinusNumbers:=True
     
 
End Sub
Code:
Sub texttocolC()
Dim r  As Range
Set r = Range(Range("C1"), Range("c1").End(xlDown))

    r.TextToColumns Destination:=Range("C1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
        :=".", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1)), _
        TrailingMinusNumbers:=True
Range(Range("a1"), Range("a1").End(xlToRight)).EntireColumn.AutoFit
End Sub
Code:
Sub findcommondomain()
Dim j As Integer, k As Integer, r As Range
Dim m(1 To 8) As Integer, x As String, y(1 To 8) As String
Dim z
j = Range("C1").End(xlDown).Row
Set r = Range(Range("c1"), Range("c1").End(xlDown))
For k = 1 To j
x = Cells(k, "c").Value & "." & Cells(k, "c").End(xlToRight).Value
'MsgBox x
Cells(k, "j") = x
Next k
Set r = Range(Range("J1"), Range("J1").End(xlDown))
For k = 1 To j
x = Cells(k, "J")
m(k) = WorksheetFunction.CountIf(r, x)
'MsgBox m(k)
y(k) = x
Next k

z = WorksheetFunction.Max(m)
'MsgBox z
If z > 1 Then
MsgBox "coomon domain is " & " " & y(z)
Else
MsgBox "no common domain"
End If
End Sub
Code:
Sub macrooverall()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Range("B1:J1").EntireColumn.Delete
texttocolA
texttocolC
findcommonurl
findcommondomain
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub

Last edited by venkat1926; 11-22-2009 at 01:20 AM.
venkat1926 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 11:42 PM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85