Double Click to Get Filtered Data in New Worksheet - excel

I recently developed an excel model that uses a regression to predict corporate bond ratings. The regression and misc. data is in a worksheet called bonds. In the same worksheet, "bonds", I then found the difference between my model's predicted ratings and the S&P's actual rating. Next, I created a separate worksheet called NotchDiff, which requires a user to input a number between -9 & +9 and bonds with a difference greater than or equal to that inputed number will be displayed.
Now, I want to write a code so that if I want to do further analysis on a bond within the Notchdiff worksheet all I have to do is double click the ticker and it will generate the necessary info in another worksheet. My problem is writing the code that tells excel a double click on a ticker in the Notchdiff worksheet means go to a new worksheet and filter the necessary information.
Is this even possible?


Creating and formatting new worksheet with data from another worksheet

I'm trying to reformat/create a new Worksheet using Excel Data found in one Worksheet. The new worksheet will have a standard template as follows:
The data is collected from the following:
Each Invoice Reference Number can have multiple BOL Ticket Numbers, but there can only be one Invoice Reference Number as the header. I'm looking for ways on how to automate this process by possibly searching through the Invoice Reference Numbers, identifying which is unique, and appending the pertinent data, then looping for the next unique number. Any help or suggesting would be appreciated.

Managing data in slave spreadsheets when changes are made to the master in Excel

I work in a school and have created a bespoke data collection and analysis tool using Excel. I am now looking for a way to manage and analyse the data more effectively and am in the process of creating a number of workbooks for different purposes:
The master workbook with a list of all pupils in the school and their characteristics (their Universal Pupil Number (UPN), name, year group, class, year they joined the school, whether they have special needs etc.)
Example Pupil Characteristics Workbook
A workbook to identify and list key pupils based on a range of characteristics which make them 'vulnerable'
My original workbook used to track assessment data by year group Example of Workbook 3
I would like workbooks 2 and 3 to copy the basic pupil characteristics data from workbook 1 so that they consistently show the pupils that are in the school at the moment that the workbook is opened, even if Workbook 1 is not open. I have found VBA code which I believe will do this.
My issue is that users will enter assessment data into Workbook 3 which links to the pupils in Workbook 1. If pupils leave or join the school, the master data (the list of pupils and their characteristics) in Workbook 1 will change. I have been unable to find a way to have Workbook 3 compare the pupil list with Workbook 1 and delete or add rows so that the assessment data that has been entered remains aligned with the correct pupils.
My assumption is that I can use the UPN column as a way of comparing the data but I am unable to work out how to:
Get Excel to check whether a new child has joined the class and, therefore, add a row to Workbook 3 and copy the new pupil's data from Workbook 1
Check whether a child has left and delete the entire row of data in Workbook 3 so that the assessment data continues to match with the remaining children.
Would I need to write code that would cycle through the UPN cells in order to compare Workbook 3 with Workbook 1 and add or delete rows accordingly? If so, I am not sure what that code would look like and, despite searching with many variations of terms, I have been unable to find anything similar.
Any advice would be greatly appreciated.
Your first place to start would be learning about the Scripting.Dictionary. It does require the Microsoft.Scripting.Runtime reference, but it is a powerful way of determining existence of a key. I use the word key since this is the terminology used within most key-based collections.
Some very rough code would look like this (again, very very rough):
Sub Foo()
Dim Students As Scripting.Dictionary
Set Students = New Scripting.Dictionary
Dim Data As Variant
Data = ActiveSheet.ListObjects(1).Range.value
Dim UPNColumnIndex As Long
UPNColumnIndex = 1
Dim i As Long
For i = LBound(Data, 1) To UBound(Data, 1)
If Not Students.Exists(Data(i, UPNColumnIndex)) Then
Students.Add Data(i, UPNColumnIndex), vbNullString
End If
End Sub
All this does is build a dictionary that uses the UPN as the key. Your next step would be to store the records as the items (where vbNullString is currently). You could then take the record from the dictionary Students(SomeStudentUPN) and put it on the sheet as needed.
Likewise, you would check iterate over the records in Workbook3 and remove them If Not Students.Exists(SomeUPN).
Hopefully this will get you pointed in the right direction. I personally use a couple of classes for this process, but I dont have a handy way of sharing that code. I would strongly recommend first learning the dictionary model, then seeing if you can create a good container to move records around.
Good luck!

How do I populate an Excel field with changing web data?

I'm building a list on Excel 2011 (mac version). The first column is a list of websites. The second column is a list of corresponding Alexa Global ranks.
The Problem: Alexa rankings change on a daily basis and my list needs to stay up-to-date. Can I link Excel to Alexa, so that each time a website's Alexa rank changes, it's corresponding Excel field changes accordingly?
Ex of a website's Alexa page:
You could get external data from the web, using Excel's inbuild ability to do so. However this would be extremely time consuming.
If you did this for your example above you would have to create a worksheet with CNN's Alexa page linked to it. Then you would have to find the cell that contained the text "Global rank iconX Y" where X and Y are numeric values. These values are the Global ranking and change in the last 3 months respectively.
In this example the cell is A87. Then it's just of cleaning up the redundant data from the cell using a formula like:
=LEFT(SUBSTITUTE(A87, "Global rank icon", ""), FIND(" ", SUBSTITUTE(A87, "Global rank icon", "")))
This leaves you just needing to create a macro on the workbook open event:
Private Sub Workbook_Open()
End Sub

Excel Vba Function for a counter

I need to keep memorized a progressive number in a function.
I have a file with some invoices to be repeated in a new sheet, the invoices have a progressive number. This number is relevant to avoid double registration in the new sheet. How can I keep this number in a function and start from it for updating.
At the moment I am using a cell in a worksheet (but I 'd like to use a function)
protocol_number = activecell.value (I get the prot nr in a sub)
different sub
if Range("a1000") = activecell.value then
Msgbox "the protocol number has been registered yet"
update code
Thanks for helping me
I think I was not so clear. I'm sorry about that. I'll try to clarify it.
2 workbooks
First one is a summary of a huge detailed (2nd) workbook for a big Financial Company, with several invoices entered by an employee.
Invoice numbers are different and alphanumeric (we are in Italy and it's possible). But it is mandatory in Italian accounting to set all the invoice entering by a progressive number called protocol number.
This protocol number marks the line of input with invoice number, amount, company, vat, and date of issue.
Transferring the data to the summary workbook I always let the code start from the beginnig (as the pick up of invoices is always retrieved from a different Financial operating software, which creates a new excel file with all invoices, even the ones already reported on the summary workbook), keep looking to the protocol nr, match with the last one entered and from the matched one keep updating the summary workbook. (remember the protocol number in the only data not transferred in the summary workbook, if it was I could match it)
Now I used to put the last protocol number used in a cell which can be cancelled or overwritten or other. So I was asking if there is a function (and you clerly said is not possible) that keeps the last protocol number entered and on the next updating match it with the invoice workbook and go further with updating if needed.
I do not post the code as I am still using the cell as protocol number keeper.
Hope this is clear
You need a so-called static variable:
Sometimes you want to retain the value of a variable in Excel VBA when
a procedure ends. You can achieve this by using the Static keyword.
Static protocol_number As Integer

Consolidating Excel worksheet rows into one worksheet in the same workbook [closed]

I have an Excel workbook that has several worksheet (by team member name). Each team member maintains a list of projects/tasks. All column titles in each worksheet are identical.
I need a worksheet within the same workbook that consolidates all projects from each team members' worksheet for a one time review instead of the manager having to jump between multiple tabs.
The consolidated (main worksheet) worksheet needs to automatically update as employees changes within cells, or add/remove rows.
Is there a macro or function in MS Excel 2007 that enables thus functionality?
I believe you could do it without a macro:
As the commenter in this post mentioned, I'll explain what's in the link for archival reasons. The function there is INDIRECT(), which expects an address given as a string and returns you its contents. It will allow you to perform calculations cross-worksheet.