Hiding Columns by matching a cell entry to the respective row data of the columns - vba

I am trying to filter out columns which do not contain the letter I enter in a cell which corresponds to the row.
I have constructed a matrix of Blanks, K's and E's
On the top there is names
on the left there are categories
for each name and category there is an assigned K, E or Blank
I want to enter either K or E next to each category (ideally using a drop down menu) and that will filter out every name which does not have the letter I entered in respect to this particular category.
One person may have a K, E or Blank but not a combination of them within a particular catagory.
I have searched everywhere for how to do this but I'm stumped. I'm not particularly proficient in VBA or Excel but I feel like this should be a simple problem which is why it's frustrating
I'm tryin to create something like this:
If
the value in cell(x,n) [column, row] = "K" or "E" Then for the
range to right of column x
hide every column which does not contain an "E" or "K" in row n
or you could say only show columns which contain an E or K in row n
Thanks in advance for any help!

Related

Creation of Userform with several drop-down lists and potential listbox

I'm new to the field of VBA, so I would like to ask your help with Userforms.
I would like to have multiple drop-down lists:
the first drop-down would contain data from Sheet3, Column A, where I have project names listed;
the second drop-down is based on Row 6 (where skills are stored) where I have merged cells in the following way:
The columns in Row 6 are empty until Column D, where Column D and Column E (subskill1) are merged. Column F is empty and Columns G and H (subskill2) are merged and so on.
In other words, two cells merged, one cell empty, two cells merged, one cell empty, two cells merged, etc.; and
the third drop-down should be numbers only from 0 to 5, which represent the values under each person's subskill.
Here is a picture of my spreadsheet:
Regarding my requirements:
It does not matter which project the user chooses from the first drop-down list; the second and third drop-down lists will remain the same. So one list will not affect the other one.
However if the user chooses a project that matches with any of the skills from Row 6, then it should show in a Listbox (perhaps, not sure what is the best way) all the people from the given project who got the chosen number for their skills.
I have something like this but not sure how to modify.
Private Sub UserForm_Initialize()
Set rData = ActiveSheet.Range("A1").CurrentRegion
Me.ComboBox1.List = rData.Offset(1).Value
Me.ListBox1.ColumnCount = 6
Me.ListBox1.List = Me.ComboBox1.List
End Sub

Autofill multiple cells while filling one cell in Excel

The excel data looks like below:
Column A: Name
Column B: Role
Column C: Activity
Column D: Comments
Now in Columns A to C the entries are same and in Column D it is always different. Its like a timesheet of an employee.
So instead of filling Columns A to C the same, I want to put a formula such that when another entry in Column D is made, then Columns A to C are auto populated from the above filled data.
Please help.
You can create two tables using Format as Table:
If I understand you question right, you want to auto populate 2 different cells if a 3rd one is not empty.
Column A: Name
Column B: Role
Column C: Activity
Column D: Comments
Now in Columns A to C the entries are same and in Column D it is always different. Its like a timesheet of an employee.
Now in cells A to C add the following formula
=IF(NOT(ISBLANK(D1)),”Whatever you want in the cell”, “”)
What the function does is it looks if D1 cell is empty (you can also add ranges) and if it’s not; it adds “Whatever you want in the cell” to the cell holding the function; if cell D is empty, it leaves the holding cell empty
Alternatively, you can change the string to expression that fills your cell correctly

Use index match to return multiple values and display them in a drop down box

please help! I'm struggling with this one.
I have two worksheets. In worksheet 1 is a list of case reference numbers for people (each person is identified by a PIN).
The case numbers are in column A and the PIN in column B. Some PINS will be listed more than once and have more than one case number.
On worksheet 2 is a list of the PINs in column A with the persons name etc alongside. In column H I would like to enter an index match formula to match the pin number in say A2 against the PIN's in worksheet 1 and return the case number in column H on worksheet 2.
I can get this to work with no problem but it only returns the first value.
I wonder if there is any way of creating a drop down box so that in column H on worksheet 2 it will show ALL the case numbers found on worksheet 1 that match the PIN in say A2 on worksheet 2?
Please help, it's driving me crackers and I just cant work it out...
Lolli x

Excel 2013 conditional formatting using a formula

I have a spreadsheet in Excel 2013 with Location in Column A, Material Number in Column B and types or groups of materials sorted by material number in Column I J & K. Other columns contain data that is irrelevant here.
Column B can contain the same material number in multiple cells.
I'm trying to find a simpler way to format font and color of the items in Column B by comparing if the item is located in Column I J or K, or not at all (no formatting in that case).
I was entering an individual conditional rule to compare Column B with the value in cell I3, another rule for I4, another rule for I5 and so on.
This is getting unwieldy due to the number of items now in I J & K.
There has to be a simpler, more elegant way to do this. Conditional formatting using exact match is not letting me select a range of cells for the match value.
I just need to format the text in Column B to Bold and Blue if the number exists in Column I also, or Bold and Red if it exists in Column J or Bold and Green if it exists in Column K.
Set up a conditional formatting rule that uses a formula. The formula can contain a Countif function that counts how many times the value in cell B in the current row is counted in column I. For example, starting in row 2, select B2 and add a formatting rule with the formula
=COUNTIF($I:$I,$B2)
Take care to use the current row number in the formula and don't use a dollar sign $ in front of the row number. Set three rules, one for column I, one for J and another one for K.
You don't need a new set of rules for each row. Just apply the three rules to all the rows required.

Find values in a worksheet with two criteria matches, copy them and paste them to another sheet with VBA

Here is my problem:
Sheet1 = "Interface". Sheet2 = "Data".
Column C5:C160 in "Data" contains a list of tasks.
Row D4:M4 in "Data" contains a list of position types (jobs), which I have labelled with "job categories" from 1-10. The range D5:M160 contains work-hours for each task and position type.
Values in columns E and F in "Interface" are related to columns C and row 4 in "Data" through data validation.
What I want to do is create an advanced filter that can copy values from D5:M160 in "Data" and paste these in column G in "Interface", if the values in columns E and F "Interface" match the values in column C and row 4 in "Data" respectively, simultaneously.
This means that it should be a macro to copy and paste values with matching multiple criteria (two criteria) from one sheet to another.
I have tried different things, with no success. I have also tried array formulas, vlookup and sumifs with multiple criteria, but none of these seem work.
Any ideas?
I appreciate your help!
The index formula combined with match is built just for this.
Index returns a value from a specified table when you provide a row and column.
Match is used to return the row/column based on criteria.
So on the Interface sheet (assuming your data starts in Row 1) you can place the following formula in G1 and copy it down as needed.
=INDEX(Data!$D$5:$M$160,MATCH(E1,Data!$C$5:$C$160,0),MATCH(F1,Data!$D$4:$M$4,0))