VBA Create filter for multiple columns - excel

good night!
I'm new in VBA and my english isn't that good so, please, be patient with me =D
Since I'm new, I always did simple loops, with one column. I never had to do a filter before. So I confess I have no idea where to begin. But I'll try my best to explain, so please, help me because it's really important to me.
I need to create a loop in the first 5 columns with this logic:
1 - Search all 5 columns and create a filter;
2 - Filter: Get all rows of column A where value == 1 And all rows of column B where value == 1 And all rows of Column C where variable == 'C' And all rows of column D where values == 1 And all rows of column E where value == 1 and create another sheet(1) with all rows of the filter;
3 - Do loop 2 again, but with "J" on column "C", and create another sheet (2);
The logic is: I need to create one sheet with all the rows that I set in the filter.
Example: Find all rows on the Columns where Column A = 1 & Column B = 1 & Column C = F & Column D = 1 & Column E = 1 -> Create one sheet with all rows with this values
Just like that:
Note this: because I have Column C with "F" in a row and "J" in another row, I need to create one sheet with all rows that contains each letter.
Could you help me, please?
Thanks and have a great night!

Related

Is there a way in excel functions to search a column, and output the cell adjacent to it?

1 some items
2 price
3 all items
4 new price
a
1.00
a
c
2.50
b
d
1.25
c
In the above excel sheet example, is there a way to populate the "new price" column with the corresponding price of the same item, when the item lists do not match up? I've been trying to use the if then function like so :
if (a in column 3) matches (a in column 1) then (new price = cell right of a column 1) else (new price = 0)
I've managed to get it to work for rows where the item in the first and third columns are the same, but I can't figure out how to tell excel to search a column. So when c in column 3 and c in column 1 are on different rows, it just errors out. I need a function that will take item c in column 3, find item c in column 1, and then look at the price for item c and apply it to the new price column.
Thank you!

Excel Index Match syntax question. getting a #N/A

I starting to get the concept of how Index and Match are supposed to work, but confused as to why this formula does not work.
I have 4 user sheets with tables in use, combining data from 3 into one. This is my current setup, which is working well so far.
Sheet1 "tblClickers" (export from phishing report):
Column A = Email
Column B/C = First/Last Name
Column N = phish failure data
Sheet2 "TblAD_US" (AD Export):
Column A = Title
Column C = Name
Column E = Email
Column F = Department #
Sheet3 "TblComb": combination sheet listing relevant data from other three.
Column A = "=tblAD_US[title]"
Column B = "=tblAD_US[Name]"
Column D = "=tblAD_US[EmailAddress]"
Column E = "=tblAD_US[Department]"
Column K = "=INDEX(tblClickers[Failures],MATCH([#[Email Address]],tblClickers[Email Address],0))"
Sheet4 "TblAD_Depts" (report listing department heads):
- column c = Department #
- Column D = Department head
I now want another column in Sheet 3 that lists the matching department head (sheet4/columnD) associated with the departments of each user. The data point I will match on is the Department# listed in Sheet 2/3 and Sheet 4.
I tried using the same formula syntax as I did for Clickers, but I'm getting a #N/A error.
=INDEX(TblAD_Depts[Department Head],MATCH([#Department],Tbl_Am_Depts[Department],0))
Where am I getting mixed up here? Do I need to reference the original data source for "Department#" in sheet 2 or can I "reference the reference" in sheet3?
tl;dr, want a new column L in Sheet 3. Values returned will be column D from Sheet 4, using Column E in sheet 3 and Column C in sheet 4 to match on.
Okay, (#JvdV) had it figured out. Even though I selected each column for "Department" and changed the format to [Number], one column was still listed incorrectly.
For some reason, Column C in Sheet 4 had each "Number Stored as Text". I'll just do a [Text to Column] and call it a day!
Thanks!

Excel- How do I Find and Replace using the values from adjacent columns

I'm a complete newbie to excel so apologies for my lack of knowledge!
I have a spreadsheet with 3 columnns.
Column 1 has cells with a range of values that can be repeated several times ie A B C A A D.
Column 2 has a list of the unique values in column 1 ie A B C D.
Column 3 contains the values that I would like to updated Column 1 with ie a b c d.
What I need to do is search Column 1 using Column 2 as an array of values when a match is found replace it with the adjacent value in column 3. Ie find all the A's in Column 1 and replace with a.
I did start writing a very long if statement if value = A replace with a etc but I have hundreds of unique values so I'm sure this isn't the most verbose way
Thanks in advance for your help
Consider the use of VLOOKUP
Result = Application.WorksheetFunction.Vlookup ( lookup_value, table_array, col_index_num, [range_lookup] )

Counting instances across ranges in columns

I am creating a spreadsheet for my personal use. I need to count the number of times one column's values are equal to an adjacent column's.
Is there any way to do this in Excel without having to modify the formula every time a new row is added?
If you have column A and B now, add column C:
Column A Column B Column C
1 2 =countif(B:B, A1)
2 2
3 1
Then just copy the first value in column C, select the entire column C and paste :)
You will get:
Column C
1
2
0

Sum of multiple columns if they match

I have this table of data:
A B C D E
003B1016 1 003G1016 1 003B1016
003G1015 1 003G1391 2 003G1015
003H0121 4 003H6208 2 003H0121
003H6209 1 003H6209 1 003H6209
I want to sum B+D if A and C are identical , how would i do that?
I have another 32000 rows of data. :) Thanks for the help
Put this in cell E1 and copy down:
=IF(A1=C1,B1+D1,"")
This says - if A = C, then add B+D. Otherwise, return blank "".
EDIT for new requirements
In order to add all amounts from column B where column A matches the current row and from column D where column C matches that row, where the row in column A exists anywhere and the row in column C exists anywhere, do the following formula in E2 and drag down:
=IF(ISERROR(MATCH(A2,A$1:A1)),IF(ISERROR(MATCH(A2,C:C,0)),"",SUMIFS(B:B,A:A,A2)+SUMIFS(D:D,C:C,A2)),"")
This says: look above the current row in column A - have we seen this item before? If no, continue with the formula. If yes, ignore, to avoid double counting. Then, Look at all of column C - does the value in the current row of A occur anywhere in column C? If no, then don't add anything. If yes, Add all items from column B where column A matches the current row, and add all items from column D where column C matches the current row.

Resources