counting number of occurence in Excel - excel

I'm working on Mac and I have an Excel file with multiple sheets. In each one, I have a column that contains PDB IDs in the format (PDBID_chain_otherID). I would like to count the number of occurence of each PDBID and in which sheets it exists?
When looking for each PDBID, I would like to take only the first 4 letters and my research must be not case-sensitive.
For example: In one sheet, I have the entry 5vms.1.A - I would like to search for the number of occurence of 5vms in all the other sheets.
thank you in advance for your help.

calculate number of occurence of a character in excel
#QHrr,
I simplified the file. Now I have one column with PDB idS (A1 in excel file) AND I would like to calculate the number of occurence of each entry and put the result in column B.
for example, how many time I have the entry 5vms?

Related

Using two values in a sheet to filter and return values from a table in another sheet

I'm fairly new to coding and i've been googling around for the last few hours trying to solve this problem but it seems to be a little beyond what i'm able to do so i would be very grateful for some help
In Sheet1, I have a table which has columns between M - CV (175 columbs). For each column, i have an "ID number" value in row 3. From Row 6 to the end of the table, i have several "search terms" separated by commas in the column CV
In Sheet2, the corresponding "ID Numbers" are in column B. Column AN contains strings.
For each ID Number value in sheet1, i'm looking to find find all the corresponding cells in sheet2 where the ID number in Column B is the same, and Column AN of sheet2 contains at least one of the "search terms" in column CV
For each ID number, i'm hoping to join the entries in Column AN of sheet2 which match the criteria above and paste them into Row 5 of the respective column in Sheet1
I've gone around in quite a few circles trying to do this and i'm back to square 1 with no code to show for it.
I've tried to research both the autofilter function, and using for loops. The research i've done indicates that for loops are rather slow to run for a large data set.
I'm hoping to find a solution which is as easy to read and understand as possible
I hope i've given enough information for everyone to understand and help
THank you in advance
My Excel subscription has expired an I've started using Google Sheets for most of my spreadsheet work, so I tested this there. Some conversion may be required. I did this using formulas, not VBA also, not sure if that changes things for you.
If I understand correctly, you have two sheets with a shared key column, sheet 1 contains search terms across multiple columns, and sheet 2 contains search terms comma delimited in a single column.
With this setup we want to bring the search term column of sheet 2 into the correct row of sheet 1 by key using VLOOKUP. I made a named range in sheets which contained all my data on sheet 2 and called it "dst". My formula was then =VLOOKUP(A2, dst, 7, true) since my key in sheet 1 was in column A, dst was the range I was searching, my column with my delimited search terms was column 7 in relation to dst, and I had ordered sheet 2 by key. I pasted this formula relatively down all rows as needed.
We want to construct a regex string using our search terms across multiple columns in sheet 1, into a single cell. I used =JOIN("|", B2:E2) on sheet 1 since my search terms were in columns B:E, and this resulted in a regex that looked like this for me: alligator|dog|rabbit|lizard where alligator, dog, rabbit, and lizard, were all search terms in that row. Paste down relative as needed.
We want to run our regex against our search target cell containing the comma delimited search terms. I ran =REGEXMATCH(F2, G2) where F2 was my delimited search terms from sheet 2, and G2 was my constructed regex for the row. Paste down relative as needed.
A screenshot of my completed sheet 1:
Once you know which cells have matches you can do whatever you want.

Format list in one excel sheet to match another sheet

I have two excel documents. In the first document, I have 300 serial numbers in one column, and they are numbered by another column in the order that I want them to be in.
Like this:
1 DMPRL9DLH1M9
2 DMPRJ49AH1M9
3 DMPRL5QQH1M9
4 DMPRKDJKH1M9
I have a second list in a different excel document. This list also has the same 300 serial numbers, and 300 MAC addresses associated with them.
Like this:
DLXRD18LH1MK A4F1E89AXXXX
DLXRF02CH1MK A4F1E89AXXXX
DLXRK0C9H1MK 8489AD32XXXX
DLXRL0GPH1MK 8489AD34XXXX
I want to re-sort the list so that it matches the first list, so I can then copy all the MAC addresses to the first excel document in the right order. I tried using a custom sort list using the first excel sheet sorted list as the order, but it would not allow me to paste in 300 strings. Any ideas?
NOTE: The serial numbers do not follow any pattern.
Like #ScottHoltzman said -
In cell C1 of Sheet1, enter:
=VLOOKUP(B1;Sheet2!$A$1:$B$300;2;FALSE)
This will look for B1 within A1:A300 of sheet2. It then returns what it finds next to it.
You may copy this from C1 to the other cells within C2:C300.

How do I output the text in a cell that's in the same row as the highest number cell of a table in excel?

Sorry for the confusing title, I'm not really sure how to word this.
I have a table full of names and data, let's say 3 columns. One is names, the second is dates, and the third is numbers. I wanted to find the second highest number in the whole column, which I think I got with the LARGE function.
But now, I want to, in a different sheet, make it so that a cell shows the name or date for that second largest number I just found.
Is there anyway I could go about doing this?
For finding the Name you can use:
=INDEX(A:A,MATCH(LARGE(C:C,2),C:C,0))
And for finding the Date you can use:
=INDEX(B:B,MATCH(LARGE(C:C,2),C:C,0))
This supposes that your Names column is A, Dates is B and Numbers is C. Also consider the it supposes that the numbers values are unique otherwise it will find the first occurrence of that number. Regards,

Returning values with search or find command in Excel

I have a problem that I cannot solve. I am using data from two Excel sheets. One sheet has a 5 digit number, the other has the same number with a prefix. Example:
Sheet 1 Sheet 2
CT12345 12345
PE23456 23456
The numbers are not lined up and sheet 2 contains other data that is not used. I need to be able to search sheet 1 (entire column) for the proper prefix to assign to the number on sheet 2. I can have the data placed in an adjacent cell if needed. I just need that prefix added to the number on sheet 2. Any help would be greatly appreciated.
Fortunately MATCH allows wildcards. Please try:
=INDEX(Sheet1!A:A,MATCH("??"&A2,Sheet1!A:A,0))

How to count the number of matches between two excel files

Say I have a data set in a worksheet. I want to compare the contents of column A with the contents of column B in another file and put the result in column C. To do this, I could use the formula
=IFNA(MATCH($A1,'location/[filename.xlsx]worksheet'!$B:$B,0),FALSE)
If I then wanted to count how many matches there were, I need only to count how many entries in column C that contain a numeric value using
=COUNT($C:$C)
But, what if I wanted to count the number of matches between columns A and B, and each of those columns existed in separate Excel files?
I need cell C1 to calculate the number of matches between entries in column A of file 1 and column B of file 2. Is this possible without editing files 1 or 2? Manually copying the data is one way, but every day has different data, and C2 will need to do the same thing for tomorrow, and C3 for the next day, etc. Manually copying the data would make the workbook size balloon quickly.
Create pivot tables in File 3 of the data from File 1 and File 2. The pivot table for File 2 would have a occurrence count for every entry in the sheet. The pivot table from File 1 would only have row labels, giving you the unique entries that you are going to be searching for.
beside each pivot label for File 1, enter a formula similar to the following:
=+GETPIVOTDATA("Item",PivotTableFile1!$H$7,"Item",A4)
Should also do some error checking, which makes the formula:
=IFERROR(GETPIVOTDATA("Item",PivotTableFile1!$H$7,"Item",A4),0)

Resources