Excel: Find unique values in a column with criteria between sheets - excel

I've read many answers to similar questions but none I've seen satisfy my task, or I'm implementing it incorrectly.
I have two worksheets.
Worksheet 1:
Column A - a list of URLs
Column B - a list of anchor texts
Worksheet 2:
Column A - a list of URLs
In Worksheet 2, column B: I want to count the # of times there is a unique value in Worksheet 1, column B that corresponds to the URL in Worksheet 2, column A.
Is this possible?
Many thanks in advance.

I think you can achieve this by using a pivot table where first you select rows = urls and then rows = text_excerpts. After that, in values you should use 'count values of text'.
Then you'll have a pivot table that looks like this one:
Note that the url3, that contains 2 times the text1 and 1 time text3. In other hand, the url7 contains 1x text1 and 2x text5.

Related

Apply VLookup on all sheets of excel file in one shot along with description

I have a Data in ExcelFile 1 which look something like this
COl A
1
2
3
4
5
6
I have another excel file 'ExcelFile2' which contains over 50 sheets .
The data in this file contains two column - COlA is similar to ColA of ExcelFile1 and Col2 is Description .
My requirement is to Check what data in ExcelFile1 is matching from any sheet in ExcelFile2 and find what is the description from Col2 in ExcelFile2
Applying VLookup on each sheet will take forever . Is there a simpler automated way of achieving this ?
Looking for the help on this as soon as possible
To Vlookup multiple sheets at a time, carry out these steps:
Write down all the lookup sheet names somewhere in your workbook and name that range (Lookup_sheets in our case).
Adjust the generic formula for your data. In this example, we'll be:
searching for A2 value (lookup_value)
in the range A2:A6 (lookup_range) in four worksheets (s1, s2, s3, s4), and
pull matching values from column B, which is column 2 (col_index_num) in the data range A2:C6 (table_array).
With the above arguments, the formula takes this shape:
=VLOOKUP($A2, INDIRECT("'"&INDEX(Lookup_sheets, MATCH(1, --(COUNTIF(INDIRECT("'"& Lookup_sheets&"'!$A$2:$A$6"), $A2)>0), 0)) &"'!$A$2:$C$6"), 2, FALSE)
This is an array forumula so Ctrl+Shift+Enter

Sum values in the column, if another column data are equal

I'm trying to analyze the data with >10K rows.
It contains 2 columns. 1st column has ID number. This number is repeating from row to row different times.
Columns 2 has just numbers, which I want to sum up if value in column 1 is the same.
For example: Image showing example attached.
First, what I did - is filtered from A/Z and trying with cycle find out qty of repeating items:
Private Sub CommandButton1_Click()
Dim row, B, i, col As Long
Dim H As Worksheet
Set H = Sheets("Sheet1")
H.Activate
row = H.Cells(Rows.Count, 1).End(xlUp).row
For B = 4 To row
i = 1
j = H.Cells(B, 2).Value
If H.Cells(B, 1).Value = H.Cells(B + 1, 1).Value Then
i = i + 1
.....
Result of sum I want to place in the last row where same IDs are matching. And after all, delete those not required ones.
Appreciate in advance any help on this.
If you want to delete rows after summing then VBA is best. Otherwise you can achieve out using excel formulas only. First you need to extract unique value from first column. Then you need to sum values based on unique values you extracted. So if you have Office365 then use UNIQUE() function to extract unique values like below.
=UNIQUE(A1:A14)
Then use SUMIF() to sum for these unique values.
=SUMIF($A$2:$A$14,D2,$B$2:$B$14)
You can just use a Pivot Table.
Since you will be updating/refreshing the data:
Select a cell in your data table and Insert/Table
Then, depending on your Excel version: Summarize with Pivot Table (or similar)
Note that there is no need to sort the data.
Then you merely drag
ID to the Rows area
Value to the Values area
If your values are numeric, it should default to Sum of Values
Rename / Format / decide on totals and subtotals, etc.
To refresh, the data after changing it, you merely need to select Data/Refresh, or you can create a command button to do the same.

if 2 cells match, return the value on another spreadsheet

Here's an example table:
'Sheet one'
Column A: Name of Fruits
Column B: Quantity Ordered
Column C: Price
'Sheet two'
Column A: Name of Fruits
Column B: Quantity Ordered
How do I return the price value that matches from Sheet1 Column C to Sheet2 Column C (new column)?
I am following this formula but it doesn't provide me the correct matching price:
=INDEX('Sheet one'!B:B, MATCH('Sheet two'!C2, A:A,0))
Your lookup key consists of two columns. You have two options:
create a helper column where you concatenate the two column values, then use that for the lookup
dynamically combine the lookup value and lookup columns. This will be slow if you use whole columns, so keep it to only the rows with data.
=index(Sheet1!C1:C10,match(Sheet2!A1&Sheet2!B1,index(Sheet1!A1:A10&Sheet1!B1:B10,0),0))
If I'm reading your formula correctly, it looks like your index is returning Column B, which is quantity ordered.
=INDEX(*column to return*)MATCH(*value to check*, *column to search for value*, *search type*))
You can see 6 different possibilities HERE (and below) depending on what you're trying to do. Copy the sheet to make edits.
Standard
Index/Match:=INDEX(Sheet1!$C$2:$C,MATCH(A3,Sheet1!$A$2:$A,FALSE))
Google Sheets Query (1 Column Return/1 Match Key):
=QUERY(Sheet1!$A$2:$D,"Select C where A='"&D3&"'",0)
Index/Match/Multiply:=INDEX(Sheet1!$C$2:$C,MATCH(A3,Sheet1!$A$2:$A,FALSE))*H3
Google Sheets Query (2 Column Return/1 Match Key): =QUERY(Sheet1!$A$2:$D,"Select B, C where A='"&K3&"'",0)
Index/Match with Multiple Match Keys:
=ARRAYFORMULA(INDEX(Sheet1!$C$2:$C,MATCH(1,(O3=Sheet1!$A$2:$A)*(P3=Sheet1!$B$2:$B),0)))
See HERE for use with Excel.
Google Sheets Query (1 Column Return/2 Match Keys): =QUERY(Sheet1!$A$2:$D,"Select C where A='"&S3&"' and B like '"&T3&"' ",0)
If my answer or teylyn's worked, please check the green check mark to accept the answer.

Condense many tables with overlapping information into one table

I have an excel workbook with 15 worksheets. Each worksheet contains one table with a list of species. There is quite a bit of overlap of species among the worksheets. So I'm trying to reduce that overlap by merging everything into a table.
I need to condense all 15 worksheets into one table that lists all of the species one time, and then shows if each species was present in worksheet X. So basically the first column would be all of the species, the column names would be each worksheet, and the body of the table would be check marks indicating if the species appeared in worksheet X. Here is an example:
Worksheet 1 Worksheet 2
Species Species Code Species Species Code
Casurina equisitifolia caeq Odocoilius virginianus odvi
Columbrina asiatica coas Gavia immer gaim
Gavia immer gaim
The table I want to create
Species Worksheet 1 Worksheet 2
Casurina equisitifolia Y N
Columbrina asiatica Y N
Gavia immer Y Y
Odocoilius virginianus N Y``
There are different ways to achieve this. Below is one approach:
First create a new worksheet (referenced as Sheet1 for this example) in your workbook. Add the names in column "A". Now add your sheet name as a header in respective columns. Then add the below formula in cell "B2":
=IF(ISERROR(MATCH(Sheet1!A2,Sheet2!$A:$A,0)),"N","Y")
Where Sheet1!A2 holds the name you are looking for. Sheet2!$A:$A is your first sheet that holds the names (in column "A" of Sheet2 for this example). This will give you "Y" if the name exist or "N" if it doesn't exist. Now drag the formula cell down the length of names and it will give you what you need for sheet 2. Repeat this process for each of the sheets you have and you should have what you need. Hope this helps

Excel 2010: Vlookup Name from one column & Count and return data from another column

Hoping someone can help me here. :)
I have two columns of data in Worksheet 1:
COLUMN A = NAME (EG. TOM)
COLUMN C = TYPE OF QUERY (FAX, TEL, EMAIL, MAIL)
I would like to have in Worksheet 2:
COLUMN A = NAME (EG TOM)
COLUMN B = A COUNT OF HOW MANY FAXES TOM HAS
COLUNN C = A COUNT OF HOW MANY TELEPHONES TOM HAS
COLUMN D - A COUNT OF HOW MANY EMAILS TOM HAS
COLUMN E = A COUNT OF HOW MANY MAILS TOM HAS
If anyone can help me that would be great.
Thanks guys
You can use a pivot table. In sheet 1, click into the data table, then click Insert > Pivot table.
Drag the Name field to the rows. Drag the query type field to the columns.
Drag the Namie field again, this time to the Values area, where it will turn into a count.
Now you see a count of query types for each name in a matrix.
Use countifs instead if you really want to use formula. A pivot table would be the best way to go though.
eg for column B, row 1 on sheet 2:
=COUNTIFS(Sheet1!A:A, A1, Sheet1!C:C, "FAX")

Resources