How to sort multi-row entries in Excel? - vba

So I have a document with many entries that follow this general format.
Organization Name Title Address Phone Fax
Description line 1
Description line 2
Organization's website.
Organization Name Title Address Phone Fax
Description line 1
Description line 2
Organization's website.
Organization Name Title Address Phone Fax
Description line 1
Description line 2
Organization's website.
What I want to do is to sort them by organization and treat the first rows as one entry so excel essentially thinks:
Organization Name Title Address Phone Fax
Description line 1
Description line 2
Organization's website.
is one row. I should also add that the bottom 3 rows are merged across the cells that form the row above them. Essentially I need it to work as a database but for government workers who are so technically unsavvy they can't upgrade to Office 2007 because the whole ribbon thing is "too confusing." So I am stuck using Excel 2002. I need to be able to sort them and use the top few rows above the actual chart to include a header and sub-heading.

Do you need the description/website rows to remain merged? If not unmerge to make it easier. You've tagged it as VBA but if this is a one-time fix then is it OK to manually work on the sheet?
As a starting point I would suggest adding an identifier to each group of rows, and depending on your data quality you could do this by checking the website cell, or simply by counting rows. For example, you could insert a new column before your data and put the following in cell A2:
=IF(Left(Lower(B1),4)="http",B2,A1)
Where B1 (the row above) could be Organization, Description 1, Description 2, Organization's website, and if it is a website, we assume that on this new row we're starting with a new block of data so we'll take the organization name. If it isn't a website, we'll use the organization name we were using previously (A1 will need to =B1). Then copy that formula down until the end and the 4 rows will at least now have a common key which you can then use to mash around the data.
If there are URLs which just start www. then modify the formula or better, just search/replace "www." to be "http://www." so that your data quality has improved.

Can't you just try recording a macro daoing whatver sort operation you want using UI, and then alanyze the code, and get an idea of what you need to do?

Related

MS Access VBA to set background color of individual fields in individual records

I have programs to do this in Excel and I'm trying to find out if it's possible in Access.
Scenario: Pipe-delimited patient records of auto accidents are downloaded from hospitals, containing account numbers, lastname, etc., street address, hospital name.
Some accounts are "related", e.g., two people in the same accident. So surnames probably will be the same, street addresses will (almost) match, and account numbers will be close.
Addresses "almost" match means, e.g.:
Smith|John|123 Jones St|1234567
Smith|Mary|123 Jones Street|1234569
The full list might be 90 accounts, with maybe 3 sets of "relateds" (7 accounts total).
In Excel I sort by Street Address. Then it colors the cell background purple if everything before the space and the next two characters match. So it would color-flag these as "related". Then I sort by "Guarantor surname" (i.e., the person responsible to pay, not shown in the example), and color match surnames with a green background. Then I sort by "Patient surname" and color match those with a blue background.
It can't be done with filters--I need to see all the records each time because manual inspection is also necessary.
SO IN ACCESS, the records would be imported into a cursor, and then the cursor would be sorted by address--manually examined--then sorted by Guarantor Surname--and manually examined--then sorted by Patient Surname--and manually examined a third time.
I have already set up Access import code, but no "relateds" checks are done for those imports.
I'm looking for how I could color-flag individual fields in individual records--while they are being displayed in a cursor.
An alternative could be that after they are imported just dump the set into an Excel and modify the existing Excel code, but if it's not difficult I would prefer to do it all in Access.
Most of the Excel code is in subroutines that cycle through "Start at this row, and go until Cell R is empty". So if it's fairly easy to change an Access field+row entry background in a cursor, reworking the Excel code wouldn't be a big deal.
I'm pretty new to Access.

VBA For Auto Fill

I want to be able to choose a value in E4 on the Invoice (which must have a drop down list of Client ID, Then I want the Client Name to populate into B5 the client address into B6, The vat number into B7, Terms into E6
All the info must come from the Customer sheet as shown in the picture
Column A: Client no (ID100)
Column B: Client Name
Column C: Client Address
Column D: Vat No
Column E : Terms
I have tried everything but I cant seem to get it right, My knowledge is limited but I did write the invoice program....with help from the internet
Customer list:
Invoice:
This is deceptively simple if you stretch the boundaries of your preferred solution a little bit. Instead of entering data in E4, use a combo box. Set the source row as the ID100 column. - Your ID Column only lists unique IDs with no duplicates right?
If there are duplicates in the ID field then you have three choices.
Overhaul the table and clean your data
Take a day or week or a weekday to really think about how you want select and/or display the extra information and handle the that you'll encounter complexities
3 Give the project to someone else
I recommend the combobox because
The combo box can intellitype/autofill as you type
The autofill perk doesn't misspell, or display anything that isn't in that column that means any lookup is a guaranteed return if the user is not being a dill
You aren't looking anything up until the ID is populated so this control acts as an um..... well.... control. It's a great starting trigger.
using the combobox results you simply use your favorite lookup to get the row number (vlookup, match, find, filter, you get the point)
now grab the values from the community you need and populate the cells.
Done! Easy right?

How to retrieve all companies data in Intrinio based on tags like apturnover, 52_week_high, capex, ceo, adress etc in csv column? in intrinio

I want specific tags in CSV column with a list of all companies. I downloaded all companies details but there are only four columns in that CSV file. I want to pass all companies details as identifier and items as some specific tags.
Intrinio has limit 150 for data tag and identifier combination. so you can use Intrinio Excel Add-in and write which data tags you want in next column.
write macros like =intrinioDataPoint(A2, $B$1) for first data tags, =intrinioDataPoint(A2, $C$1) for second and so on. if you want more combination then checkout intrinio tutorial on youtube.
One option is to use the Data Point endpoint and specify the tickers and items you want to download (example). This is limited to 150 combinations of tickers/items however. They also have an Excel add-in with a data point function that you can use on every row of a spreadsheet. Beyond that, you can contact their support and request a custom data dump.

Excel - How do I find all relevant rows by typing unique invoice# listed Col A

I have a Worksheet with 10 columns and data range from A1:J55. Col A has the invoice # and rest of the columns have other demographic data. Goal is to type the invoice number on a cell and display all the rows matching the invoice number from col A.
Besides auto filter function, the only thing comes to my mind is VBA. Please advice what is the best way to get the data. Thanks for your help in advance.
Alright, I'm pretty proud of this one. Again avoiding VBA, this one uses the volatile formula OFFSET to keep moving its VLOOKUP search down the table until it's found all matches. Just make sure you paste enough rows of the formula that if there are many matches, there's room for all of them to appear. If you put a border around your match area then it would be clear if you ever ran out of room and needed to copy down the formula some more.
Again, in the main section, it's just a single formula (using index):
=IFERROR(INDEX($A$1:$J$200,$M3,MATCH(N$2,$A$1:$J$1,0)),"")
This gets to be so simple because the hard work of the lookup is done by an initial column which looks up the next row that matches the invoice number. It has the formula:
=IFERROR(MATCH($L$2,OFFSET($A$1:$A$200,M2,0),0)+M2," ")
Here is the working example that goes with those formulas:
Let me know if you need any further description of how it works, but it mostly uses the same rules as above so that it's robust in copying and moving around.
I've uploaded the Excel file so you can play with it, but everything you need to reproduce this feature should be in this solution.
Google Docs - Click link and hit Ctrl+S to download and open in Excel.
A popular solution to this problem is a simple VLookup. Lookup the invoice the user types in on the table A1:J55, and then return an adjascent column's data.
Here's an example of it working:
The formula in the highlighted cell is:
=VLOOKUP($L3,$A:$J,MATCH(N$2,$1:$1,0),FALSE)
What's nice about this formula is you only need to type it once and then you can copy it across and it'll automatically pick out the correct column of the table (that's the match part). The rest is very simple:
The first part says lookup value $L3 (the invoice number typed in),
The second part says look it up in range $A:$J (which is where your table is located). I've shown how you can select the entire columns $A:$J so that you can add and remove data without worrying about adjustin the range in your lookups. (Excel takes care of optimizing the formula so that unused cells aren't checked)
The third part picks the column from which the resulting data will be drawn once a matching row is found.
The FALSE part is an indication that the invoice number must match exactly (no approximate matching allowed)
The $ signs ensure that fixed ranges like the location of your source table ($A:$J) and your lookup value ($L3) don't get automatically changed as you copy the formula across for multiple columns.
The formula is pretty easy to adapt if you want to move around your table and the area where you do your lookup. Here's an example:
Bonus
If you want to add a little spiff, you can add a dropdown to the Invoice # field so that the user gets auto-completion and the option to browse existing values like so:

Extracting Data from People Picker in Sharepoint 2010

I am trying to build a custom list where I have people's names and email addresses in two different columns. Since I'm hooked up the the active directory, I would like to select the person's name from the AD and then have their email address automatically populate in another column.
The only way I have figured out to do this is to find the person's name twice in the active directory, first in the "Name" column and secondly in the "Email" column (which is formatted to show the person's email). Can I do this with only having to enter the data in once. It would be so much easier since I have to add hundreds of names to the list.
Also, and this is probably a little bit harder, the title of the row is the person's name and right now I have to manually enter it, but can it be automatically populated based on the people picker name selected from the AD?
Dave