I have a spreadsheet where in every column I have a list of names. They can repeat, and whats even worse - cells can contain some additional text (apart from the name).
What I want to do is count the occurrences of the name in the whole spreadsheet (only looking at the name, omitting the potential additional text). Is Possible?
I tried the formula =UNIQUE, but it does not work vertically (I'm working with Google Sheets)
Example of a document https://docs.google.com/spreadsheets/d/1STtJr0yisSeuv2w8_JVgQABAL5EDzI8aFmH8Vp2cOko/edit?usp=sharing
You can use Countif, Arrayformula, and Regexreplace to accomplish this task
Assuming you have the data range from A2:E12 and the prefilled unique names starting from A14
Formula:
=countif(ARRAYFORMULA(regexreplace($A$2:$E$12,".\(.*","")),A14)
Copy the formula until the last row
Hope it helps!
I'm sure that others will provide a much more elegant solution but this takes the data as presented in the spreadsheet and can be implemented in just a few minutes.
Paste this formula in Cell F3
=FILTER({A3:A13;B3:B6;C3:C5;D3:D5;E3:E5;A18:A21;B18:B20;C18:C20;D18:D20;E18:E19}, LEN({A3:A13;B3:B6;C3:C5;D3:D5;E3:E5;A18:A21;B18:B20;C18:C20;D18:D20;E18:E19}))
This creates a single column list compiled from the various smaller lists.
Highlight the range of names created in Column F (based on the test data = F3:F41), click Copy,
Highlight cell G3, click Paste special (Paste Values only) - this converts the formula to a list for entries.
Paste this formula in Cell H3 - this removes any data in brackets
=left(G3,iferror(search(" (",G3)-1,len(G3)))
Copy the formula down as many rows as there is data in Column G
Paste this formula in cell I3 - this lists the unique names
=unique(H3:H41)
Paste this formula in cell J3 and copy down as many rows as there is data in Column I - this counts the number of instances of each unique name in the master list.
=COUNTIF(H:H, I3)
Related
I have a Google spreadsheet with 5 tabs (sheets) and I want to copy rows of data from one sheet to another, IF a criteria matches in one of the sheet.
Sheet1 has hundreds of rows of data, across numerous columns. One of the columns lists dates. That column is mostly set to Date format. That date col also uses various Conditional Formatting rules. (I cannot change these or the formatting of this column!).
In sheet5 I have a formula that is supposed to look at sheet1 and find all the rows with a certain date in the date col and then copy the data in that row to a row in sheet5.
It looks like this: =INDEX(sheet1!$A1:$O2002,MATCH($B$1,sheet1!$Q:$Q,0),0)
It kind of works... if I just paste the formula in one cell in sheet5, it finds a row matching the date criteria and copies data over. But if I want to query more of sheet1, by dragging the cell down and find more rows of data to copy over... it just copies all the rows from sheet1 after the initial find... completely ignoring what it's comparing in $B$1 to $Q:$Q... I suspect that what I think it's comparing in MATCH($B$1,sheet1!$Q:$Q,0) may not be what's actually happening, hence the result not matching my expectations...
Here is a screen capture of the sheet I want to copy data from: This sheet is set up and controlled by another party. I CANNOT change data; I CANNOT change data format that is already entered (eg I can't change a col set to Date to Plain Text!) See red notes.
But I can convert Dates in col N to Plain Text in col Q. Column Q is what I am querying/comparing in the formula in the destination sheet (see second screen capture below)
Sheet1 capture: data to copy, criteria date col
In sheet5 I have this formula that queries sheet1:
=INDEX(sheet1!$A1:$O2002,MATCH($B$1,sheet1!$Q:$Q,0),0)
Here is a screenshot of what that formula produces in sheet5
Sheet5 capture: result of using formula
Notice, it kind of works...(when I just paste the formula into my starting cell... it found the one line with the criteria I set) but then if I drag B3 down to query sheet1 more... it just grabs everything, even if $Q:$Q doesn't match the criteria set in B1...
Why?
Any help or clarifying questions are appreciated. Thanks
when dragging you did not lock the rows with $
your formula:
=INDEX(Sheet1!$A1:$Q100, MATCH($B$1, Sheet1!$Q:$Q, 0), 0)
should be:
=INDEX(Sheet1!A$1:Q$100, MATCH($B$1, Sheet1!Q:Q, 0))
coz with your initial formula you just created sort of a "sliding range" by every drag-down. to understand the formula... you are indexing range A1:A100 (from row 1 to row 100) where you narrow it down to just 13th row (MATCH outputs row 13 coz there is the match found. next you drag down and indexing range changes to A2:A101 but the MATCH formula always outputs 13 so 13th row from range A2:A101 is row 14, etc.
anyway, use this in Sheet5!B3 after you delete everything in B3:B range:
=FILTER(Sheet1!A:P, Sheet1!N:N*1=B1*1)
I'm working in Google Sheets. I have a few hundred cells that contain text and numbers. The cells contain employee names and their ID#s. I want to extract the ID#s and compile them into one list. I have the formula below that will let me complete the task, but only for one cell, not for a range of cells (even if I select a range and add it to the formula):
=transpose(split(regexreplace(regexreplace(A1,"\s\d+\s"," "),"[^\d\.]"," ")," "))
For example, cell A1 would contain, "Tammy - 123456, Bob - 654987, Mike - 321456" and repeat similar until you get to something like cell DT75 "Marcus - 35768, Bruce - 95126, Lisa - 789123". Some cells in the sheet are blank. The above formula will give me the ID#s from A1 in their own cells:
123456
654987
321456
I'd like to get one column of all the ID#s in the sheet that I could then copy and paste into a completely different proprietary database. Am I coming at this the wrong way? Is a script a better angle?
Since you want your original range to be multi-column, you could try a slightly modified version of player0's formula, like this:
Use CONCATENATE to put all data in a single string.
REGEXREPLACE to remove everything but the numbers from your string.
SPLIT to divide your string into several cells, blank space being the separator.
FLATTEN put all resulting values into a single column.
=FLATTEN(SPLIT(REGEXREPLACE(CONCATENATE(A:DT), "[A-Za-z-,]+", )," "))
try:
=INDEX(FLATTEN(SPLIT(QUERY(REGEXREPLACE(A1:A, "[A-Za-z-,]+", ),,9^9), " ")))
for multi-column:
=INDEX(FLATTEN(SPLIT(FLATTEN(QUERY(REGEXREPLACE(A1:C, "[A-Za-z-,]+", ),,9^9)), " ")))
I've been trying to import some values from a JSON file but they keep adding things to the list and it's a big no-no for me (it has 2,000 rows of items already). I didn't see any information about this, and I don't understand the INDIRECT or ADDRESS functions.
Can anyone explain it a bit?
An example of what I'm doing.
I'm using Google Sheets not Excel and Sheets doesn't like unfinished formulae so when I try to concatenate the formula it adds the end brackets on mid formula!
You have to use a formula if you are attempting to concatenate strings in Excel.
What I do is put everything before the text to be inserted:
import("api.kitchen.utility/
into a cell, say E1, then the following text in E2:
"; "noheader,notruncate")
Assuming the text you want to include is in A1 - A??.
In B1 put the following formula:
=$CONCAT($E$1, $A1, $E$2)
Copy B1 and paste down to rest of range.
$E$1 means the pointer will always point to Cell E1 no matter what. The $A1 means the column will always will be 'A' but the row will increment when it is increased due to copy or fill.
A bare reference G10 (in H10) when pasted or filled always refers the the cell to the immediate right.
In other words add a $ to a row, column, or both to always point to the same row, column or cell.
I'm trying to return the column headers for a row that is marked with an x. The row is selected from a name in the left column. I'm stuck here.
I can illustrate what I want to do by showing these images:
Start table
The result I want is this:
Outputs of the possibilities for the first sheet
I have put more information in my Example Sheet.
Link to editable example sheet
This formula should create a table (with a single formula) with the months in one column and the headers in the second column.
=ArrayFormula({A4:A15\ substitute(transpose(query(transpose(if(B4:G15="x";B3:G3&char(10);));;rows(A4:A15)));" ";)})
If you'd want to 'lookup' the months you manually type in you can wrap the above in a vlookup. Example:
=ArrayFormula(if(len(L4:L); vlookup(L4:L; {A4:A15\ substitute(transpose(query(transpose(if(B4:G15="x";B3:G3&char(10);));;rows(A4:A15)));" ";)}; 2; 0);))
You can check out both formulas in the copy of the sheet I've made in the spreadsheet you shared.
Tried searching and checking Google documentation but I am still having issues getting the results that I want for this problem.
I'm needing to split several comma-separated lists of items and recombine them so that first items in each list is combined, followed by the second item, etc.
To ask with an illustration, if I have a cell with the following
Paul, John, George, Ringo
and another cell with the following
McCartney, Lennon, Harrison, Starr
How do I use one function to produce this in a cell?
Paul McCartney, John Lennon, George Harrison, Ringo Starr
Here you go, you will need to copy to every row - but assuming your data is in columns A and B it will work across a dynamic number of items:
=ARRAYFORMULA(join(",",split(A1,",")&" "&split(B1,",")))
See image example below, in row one i used the data you showed up top, and in row two i reversed the column data just to show as an example:
If you paste the first word CSV to Sheet1 and the second word CSV to Sheet2 then you could put the following into sheet3
In Cell A1:
=Sheet1!A1&" "&Sheet2!A1
This is saying take the value in sheet1 A1 and then a space " " then the value in sheet2 A1
You could also do this with the concatenate function:
=CONCATENATE(Sheet1!A1," ",Sheet2!A1)
Then just copy the formula to suit.