I want to have an Arrayformula at A1 to produce this output:
I want to have a same serial number for same names, names would not be sorted & could repeat any number of time.
Google Sheet Link
Plz try:
=ArrayFormula(iferror(match(B2:B,unique(B2:B),0)))
Related
I have a google sheet column with data that looks like this. ID numbers with count suffixes. How can I transpose them horizontally into rows on a sheet sorted/grouped/filtered by their ID number into the appropriate number of columns matching their suffix number?
Sheet Link:
https://docs.google.com/spreadsheets/d/1wq3Zrh5wE_IHP2utvMeFRHrMe1qra2ppq_G7PrSt-jY/edit?usp=sharing
What I have
INV46673-1
INV46673-2
INV56184-1
INV56184-2
INV56184-3
INV56184-4
INV56184-5
INV68328-1
INV68328-2
INV68328-3
INV68328-4
INV68347-1
INV68347-2
INV68347-3
What I need
INV46673-1
INV46673-2
INV56184-1
INV56184-2
INV56184-3
INV56184-4
INV56184-5
INV68328-1
INV68328-2
INV68328-3
INV68328-4
INV68347-1
INV68347-2
INV68347-3
If sheets has an off the shelf function for this I have not been able to find it. I have tried pivot tables, Hlookup, filtered arrays etc. I am grateful for any advice I may receive. A solution that uses a fixed character count (8) will work but I would love to see something that actually uses the exact ID number.
Try the following formula-
=INDEX(SPLIT(BYROW(UNIQUE(INDEX(SPLIT(A2:A15,"-"),,1)),LAMBDA(x,JOIN("|",SORT(FILTER(A2:A15,INDEX(SPLIT(A2:A15,"-"),,1)=x))))),"|"))
Here's another approach:
=index(let(a,regexextract(A2:index(A:A,counta(A:A)),"(.*)-(\d+)"),b,unique(index(a,,1)),c,max(--index(a,,2)),makearray(counta(b),c,lambda(r,x,xlookup(index(b,r)&"-"&index(sequence(1,c),,x),A:A,A:A,)))))
Summary
Goal: count cells that contain specific strings in columns A AND B checking each pair of rows in the columns.
What I have So Far: =IF(AND(B3="GA", C3="Grocery"), COUNTIF(C3, "Grocery"),0)
What I Need: how to specify continuing this process for each pair of rows in columns A and B.
Context: counting business in different states that have been assigned specific categories. For example, how many businesses in Georgia ("GA") are categorized as "Grocery"?
Example Google Sheet
Details
I am creating a function with the goal of checking cells in columns A and B in the same row to match a specific string for each, adding +1 to the count if they both match, then checking the next row in columns A and B. How can the function be written to continue checking all of columns A AND B row by row?
Thank you!
Try something like-
=BYROW(FILTER(B3:C,C3:C<>""),LAMBDA(x,IF(AND(INDEX(x,1,1)="GA",INDEX(x,1,2)="Grocery"),COUNTIFS(C3:C,"Grocery"),"")))
Or try-
=BYROW(B3:C,LAMBDA(x,IF(AND(INDEX(x,1,1)="GA",INDEX(x,1,1)<>"",INDEX(x,1,2)="Grocery"),COUNTIFS(C3:C,"Grocery",B3:B,"GA",INDEX(ROW(C3:C)),"<="&ROW(x)),"")))
As per sample sheet provided in comment, you can try this formula.
=COUNTIFS(C3:C,E16,B3:B,"GA")
try:
=INDEX(IF((B3:B="GA")*(C3:C="Grocery"),
COUNTIFS(C3:C, "Grocery", ROW(C3:C), "<="&ROW(C3:C)), 0))
E.g. I have the following sheet and formula, but I only want to transpose the data if it contains a specific month, specified in A2.
try:
=TRANSPOSE(UNIQUE(FILTER(A5:A; B5:B=A2)))
You can use a query for that.
=TRANSPOSE(QUERY(A5:C, "select A where month(B)+2="&MONTH(A2)&""))
The reason we add +1 is because months in a query start from 0
Can you please help me figure out the right formula for the below problem?
I want to count unique Item ID in Column A with a date range per agent.
You may find the link to the spreadsheet below:
https://docs.google.com/spreadsheets/d/1s-A3a-M5BlJI3xWNgeoL9ERKK056_0dsmSH7aae0TAY/
Thanks in advance for your help!
France
Based on your spreadsheet, you can nest a FILTER command inside of a COUNTUNIQUE function like so:
=COUNTUNIQUE(FILTER($A$2:$A,$B$2:$B=E2,$C$2:$C>=date(2018,3,1),$C$2:$C<=date(2018,3,8)))
You will have to enter the dates by hand, but the $B$2:$B=E2 will reference the Agent name from the E column in your spreadsheet. All of the references with a $ in google are absolute, and will not change as you move the function around within the sheet.
Option with QUERY for H2 and copied down to suit:
=count(query(A:C,"select count(A) where B='"&E2&"' and C>=date'2018-3-1' and C<=date'2018-3-8' group by A label count(A)''"))
Adjust the upper cutoff day to suit.
I'm trying to count bus headways --the number of minutes between bus arrivals--in Google Sheets. The arrivals are written as 0:00, 1:00,2:00, etc... I want to count the number of instances of zero-minute buses, one-minute buses, etc..
When I try this =countif(range,"0:00"), I get "0:00" as an answer. What am I doing wrong?
Change the formatting of the range to text and then try
=countif(range, "*:00")
Maybe try using a Pivot Table:
One option is to use a helper column along with ISNUMBER and SEARCH.
Let's say your data is in A1:A3. In B1, you could put =ARRAYFORMULA(IF(ISNUMBER(SEARCH(":",A1:A))=TRUE,1,"")).
That searches for ":" in column A. If the statement evaluates to TRUE then a 1 is placed in the corresponding row. If it evaluates to FALSE then nothing "" is entered.
Then in C1 you could put =SUM(B1:B).