Use of Index and Match function with Count/Counta/Countif to count the results on a 3rd wookbok - vba

I have great success in guidance from the experts on Stack. I need guidance once more. :)
I have workbook 1 that has a copy of names on column A and email addresses on column B. Workbook 2 that has copy of names on A and email addresses on column B and data that I need copied on Column c on workbook 2.
I have a workbook 3 in which I would like to use to build a table with matched and counted from the formula I need. Below I will show.
workbook 1 pic:
Workbook 2 pic:
Workbook 3 pic:
Ultimately, I wanted the index,matched and counted total to show up on the basic table shown on workbook 3. As you can see there are 4 email addresses that match between work book 1 and workbook 2, but there are also 4 email addresses that do not match. after the matching and unmatching is found, i want the formula to give me the count of the matched and unmatched from column c in workbook 2.
so if you just use your eyes and count, you will see that rows 2 through 4 these email addresses matched between work book 1 and work book 2. that would give me a total of 2 drinks expenses and 2 food expenses from the matching found, but also give me 2 tickets expenses and 2 parking expenses from the unmatched found.

For the Matched:
=SUMPRODUCT((COUNTIFS('Sheet1'!A:A,'Sheet2'!$A$2:$A$100,'Sheet1'!B:B,'Sheet2'!$B$2:$B$100)>0)*('Sheet2'!$C$2:$C$100=$B3))
For the unMatched
=SUMPRODUCT((COUNTIFS('Sheet1'!A:A,'Sheet2'!$A$2:$A$100,'Sheet1'!B:B,'Sheet2'!$B$2:$B$100)=0)*('Sheet2'!$C$2:$C$100=$B7))
These are untested as I did not want to retype that much data, but in thoery should work.

Related

Set the value from another sheet. With a test of condition. Excel

I have a table with two sheets. On the first (1) the name is written, on the second (2) Imin and numerical meaning are written, the same name can be written several times. There are also names that are not present on the sheet (1).
Sheet 1.
A
Column A
Column B
Vova--
Ben
Sheet 2.
Column A
Column B
Ben +
2
Timmy
1
Ben T
4
Vova
6
How to put in the first sheet the sum of the values from the sheet (2)
I tried:
=IF(ColA2 = $Sheet2 ColA2; $Sheet2 ColB2)
=VLOOKUP(A1;$Sheet2.B2:B4;2)
=SUMIF($'Sheet2'A1:A4;A1;$'Sheet2'ColB1:ColB4)
Not work
Does not summarize the value
Looking for accurate coincidences
Names can end in different ways ...
Ben = Ben T
Required:
Column A
Column B
Vova--
6
Ben
3
Need help please.
I found an answer. I need to use LEFTB
=SUMIF($'Sheet2'A1:A4;LEFTB(A1;4)&"*";$'Sheet2'ColB1:ColB4)
or
=SUMPRODUCT((LEFTB($Sheet2!$A$1:$A$4;3)=A2)*$Sheet2!B2:B5)

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 vba code to copy names found in multiple worksheets and count how many times they appear

I need some help writing some VBA code.
Basically I have one spreadsheet with 4 worksheets (CLIENT1, CLIENT2, CLIENT3, CLIENT4)
Each worksheet contains a column called CONTACT.
This CONTACT column contains a person name
The CONTACT column can be in a different position in each worksheet ie the CONTACT column in CLIENT1 is in Column D whereas it appears in column E in CLIENT2
I would like some help writing some code that will create a new Worksheet called SUMMARY.
The SUMMARY worksheet would contain in Column A a list of all the names found in the CONTACT column and in Column B it would count the number of times that persons name was found.
So the SUMMARY worksheet would end up looking something like this.
A B
1 John Smith 4
2 Brad Black 2
3 Gary Soth 1
4 Bob Brown 6
5 Sam Drow 2
Hope this makes sense and thanks for your help
Andy
Note : I am just playing with Excel and not using VBA but think you can achieve it without using VBA also.
You can use COUNTIF and solve your problem.
I will show you step by step. I cant attach excel here so adding images. If you wish to have excel which i prepared then just give me your email, I will send it.
This is summary which I got by using the formula (you can see that highlighted :
Client Name column can get value from the sheet where you can combine all your unique client names and use that as base.
Check Client1, 2, 3 & 4 sheets.
Hope this may help you.
Just found that in Excel you can use the Remove Duplicates function to remove all unwanted names. I can then use the count function across all 4 worksheets to get the required information.
Thanks
Andy

How to compare a list of rows to another list of rows in Excel?

I am trying to figure out if there are any differences between a list of data with another. In order for a row of data to "match" with another row, the row must have the same values in their corresponding column. The rows themselves do not have to be in any particular order. In particular, I am dealing with a parts list, where there are part numbers, descriptions, etc. I am trying to figure out if any rows of data are different from rows of data from another list.
I found Compare two sheets using arrays, which may have the answer to my problem, but I am having trouble figuring out how to adapt to my code due to inexperience in Visual Basic.
I was able to get it to work for a single column of data, comparing one column of data from one sheet to another, but cannot get it to compare entire rows of data.
Here is an example of I want this to work:
Sheet 1 Sheet 2
Column 1 Column 2 Column 1 Column 2
Row 1 22a 33 11 11
Row 2 22a 33a 22a 33
Row 3 55 22b 55 23b
The code in the link will tell you what is not in sheet 1 but in sheet 2 and vice versa. In this example, I would like the code to tell me Sheet 1 Row 2 and Sheet 1 Row 3 are not in Sheet 2, and Sheet 2 Row 1 and Sheet 2 Row 3 are not in Sheet 1 (Sheet 1 Row 1 and Sheet 2 Row 2 match).
If that is ok by you, you can do it without VBA using the following formula:
={IF(IFERROR(MATCH(A1&"|"&B1;Sheet7!$A$1:$A$3&"|"&Sheet7!$B$1:$B$3;0);-1)=-1;"Unique";"")}
Assuming that each of your tables start in A1 (so that the tables with three entries span A1:B3), and entering this formula into C1 (and copying it down), press CTRL+SHIFT+ENTER when entering the formula to create an array formula, this will show the word "Unique" in column C if the pair in that row on that sheet is not in any of the row-pairs on sheet 2.
You can then use conditional formatting to highlight unique rows, filter on the tables to include only unique rows, or some other way of doing what you need.
NOTE 1: I have entered my numbers in Sheet6 and Sheet7 instead of 1 and 2. The formula written above goes into Sheet6.
NOTE 2: My language use ; instead of , as function separator, so if yours use , you need to change that.
NOTE 3: You will need to expand the ranges Sheet7!$A$1:$A$3 and Sheet7!$B$1:$B$3 if your set grows (this will happen automatically if new rows are inserted in between the old ones). The best is still probably to create named ranges for each of the 4 columns, exchange the references with those, and manage the named ranges instead of the formulas.
NOTE 4: If your data set contains the character "|", you need to change that as well, to match some character that you for sure do not have there.
Alternatively you could in column C on each cheet enter (assuming first entry in C1)
=A1&"|"&B1"
and copy this down, then run the solution from your copied example using that C column instead of on A1 and B1.

VBA Loop Statements Excel, Matching, Counting

I've never written an excel VBA statement before and would like some guidance.
I have a workbook with multiple sheets open. I'm trying to match data on sheet 5 with data on sheet one and count the sum of all values that match.
Sheet 5 looks like this:
Company Name Matches
Company A 57
Company B 31
Company C 20
Company D 10
Sheet 1 looks like this:
Company Name Dollar Amount
Company A 45000
Company B 50000
Company A 60000
Company A 62000
Company D 70000
Sheet 1 is several hundred lines long.
Basically, I need to count the aggregate dollar amount in Sheet 1 for all instances where the company name in sheet 1 matches the company name in sheet five.
I tried a countif and countifs statements in excel. I did not receive the result I needed. I think I need to use a do until loop to calculate what I need. Unfortunately, I have no experience in this area (my expertise is law).I'm sort of stuck knowing where I need to go but not sure how to get there.
I'd appreciate any help. Thank you for your time.
Assuming that your Aggregate Dollar Amount ("Total") is on column B in "Sheet 1" then on B2 you would place the formula:
=SUMIF(Sheet5!A:A,Sheet1!A2,Sheet5!B:B)
This will add all Dollar Amounts on "Sheet 5" if the corresponding values on Column A is equal to A2 (ie "Company A"). You can then drag down it will reference the appropriate company name. Regards,