Excel drop down list to convert full name & enter Abbreviations - vba

I have a database called Overtime with a second sheet called data. On the first sheet I am using data validation to access the data list on the data page. At present The list has peoples full names. What I want to do is when a name is selected it then changes it to the Initials from the Data sheet. Not sure if this can be done into the one cell, or to use something like Vlookup to enter the initials into an adjacent cell. The names and Initials are on the same rows on the data page (in columns "I" & "J"). On the main database the validation list is for column "O". I have a column "P" ready to put in the formula to show the initials if this the only way it can be done.

With data in the Data sheet like:
In P1 enter:
=IF(OR(O1="",NOT(ISNUMBER(MATCH(O1,Data!I:I,0)))),"",VLOOKUP(O1,Data!I:J,2,FALSE))
and copy down.

Related

generate a hyperlink in sheet linking to matched data found in a different sheet

I have two different sheets in a workbook with data, all of this data is organized by Site ID's. What I want to do is use these site ID's to create a hyperlink in one of the data sheets that when clicked takes the user to the corresponding Site ID in the other sheet. The sheet name where I want to write the hyperlinks to is called "Report_Manual" and I want to write hyperlinks down every row down the first column. The sheet that I am hyperlinking to is called "Data". The premise Ids are located in column C for sheet "Report_Manual" and column K in sheet "Data". Below is an a ttempt of what I was trying to generate in excel for a single cell formula however the issue I ran into for this formula is that the Premise ID's in sheet "data" are variant data type while the Premise ID's in sheet "Report Manual" are integer data type. This makes even a simple formula like the one below not get any matches as the data types being matched aren't the same.
=HYPERLINK("#"&CELL("address",INDEX(Data!K3:K580001,MATCH(C3,Data!K3:K580001,0))),C3)
If anyone has any idea of a macro to solve this issue that would be extremely helpful.
If the IDs in "Data" are text, try changing your match lookup value to text:
=HYPERLINK("#"&CELL("address",INDEX(Data!K3:K580001,MATCH(TEXT(C3,0),Data!K3:K580001,0))),C3)

CheckBox to limit a data validation list

Moving forward, slowly.......
I added a column, that with the combination of my checkboxes, gives the name of active employees.
Screen Shot of active list of employees
If I use $T$6:$T$16 as my validation list, I still get 11 options in the drop down. I want the drop down to show only the 5 names that are in that list.
No need to use VBA here, Here's a quick solution.
Use a 1 or 0 in a column next to the employees' names corresponding to whether they are active or not.
Then create a column in the sales sheet which has a vlookup for this value
=VLOOKUP(E4,$A$4:$B$8,2,FALSE)
This looks for value E4 (the name), in range of all names, second column for their active status, FALSE for an exact match.
Then use a filter:
Highlight range of sales
"Data" tab
"Filter"
Then you can use the filter on the new Active column to only show the employees which are still active. See the linked image for the final outcome. The vlookup lives in column D.
Final outcome image in Excel
Of course if you want this in two sheets, you can split what I've done to different sheets with no extra effort other than adding sheet references to the range in the vlookup.
Hope this helps

Trying to get the Column Values in 1 sheet to other sheet in Row with Dynamic Updation from 1st sheet

I have been trying to get the above data which is presented datewise in Column form to be pasted in the below format in Row form, but challenge is either 1 date at a time can be taken or either single cell reference needs to be given in each cell on other sheet, need some shortcut such that sheets data remains dynamic and datewise data is copied. Image shows it in one sheet, above data is required to be shown in below format in other sheet.
Thanks and Regards
Mandeep Goraya
For example, your table is like this:
Put this code into cell B8 then fill right:
=INDEX($B$2:$F$3,MOD(COLUMN(A1)-1+ROWS($B$2:$F$3),ROWS($B$2:$F$3))+1,1+INT((COLUMN(A1)-1)/ROWS($B$2:$F$3)))

Allow text overflow despite data in adjacent cells

Is it possible to have text populate in a cell and allow it to overflow into adjacent cells even though there is data in those cells? Here is my layout and situation:
I have a worksheet that acts as a "Report" sheet which populates data based on drop down selections at the top of the report sheet. The user can select any one of 8 countries to view that specific data, and the report sheet populates cells D16 through P25. The user can also select to view all 8 countries. In this instance, country data will populate in blocks of data (D16:P25, D27:P36, D38:P47, etc.) When looking at only one country, the other cells with data are blank (the formulas return "").
I need the text overflow now because I was asked to incorporate a summary of applicable limitations below the first data table when viewing only one country in the report. For example, if the report is selected to view Belgium, the data populates in cells D16:P26. Now, I need to show in cell D18:D22 a summary of the local laws. I can incorporate the necessary text using IF statements into column D, but it is cut off because there are formulas in columns E - P currently returning no values that need to return values for the "All Countries" view.
Can this be accomplished?
I assume you use VBA to fill in the data when the user selects an element in the dropdownbox. When handling this change, you should actually clear the cells that are giving empty results, instead of having formulas in there that don't do anything useful.

Excel or SQL Server - Multiple columns to rows

In Excel 2010 or Microsoft SQL Server 2012:
I have a table that has an ID in column a, and then columns B through (C - MM) with locations.
I want to have column A be all of the locations & then column B be the ID.
Any way I can figure out so far has been to transpose by hand.
Any help would be greatly appreciated!
Imaged added: image
here's a way that's semi-automatic in Excel which will work assuming the ID row is unique (if it isn't unique, you will need to clean that up first)
Assume your original worksheet of data is named "Raw Data"
Convert the raw data into a Table or Named Range - call it Table1
Add a new worksheet, call it "Normal Data" and type "ID" into cell A1 and "Location" into cell B1
Copy the data (no header) from column A (this is the list of IDs) from "Raw Data" into column A of "Normal Data"
Add this formula to column 2 of "Normal Data" as follows, but change "X" to the number of rows of data (excluding header) you have in "Raw Data":
=VLOOKUP(A2,Table1,ROUNDDOWN((ROW()-2)/X,0)+2,FALSE)
Make sure this looks correct
Append the entire "List of ID's" a few times to column 1 of "Normal Data" a couple of times
Make sure it still looks correct
If your location data extends to Column MN, then you need 350 total copies of the original ID list.
Save the Excel to something like "Normalize Location with Formula"
Save the excel to something like "Normalized Location Data"
Copy paste values of "Normal Data" to save values only, no formulae
Save the worksheet
Optionally filter the "Normal Data" to rows with blank location data and delete
This is now ready to import to a DB (and if you didn't delete the blanks, you cand just delete them via SQL after you import)
Why this works: Vlookup gets the correct row of raw data, and then the formula dynamically adjusts to the correct column based on the row count.
Pivoting rows into columns in SQL Server
Spioter, thanks for the info. I never tried this as i finally found information about using the UNPIVOT command in SQL.
Link is above.