Allocating serial ID based on another column in Google sheets - google-sheets

I'm trying to allocate serial/sequential ID's to the students based on the course they are signed up for, which is specified in another column.
For example, if john is the first one to signup for "English", ID is "E0001", the second person signed up for "English" will be allocated "E0002".
And then, if third person signs up for a different course "Maths", I have to start another new sequence, say "M0001".
I tried several combinations with IF and SEQUENCE, CONCATENATE... but was unable to figure out a proper way of doing this. I would very much appreciate anyone's help.

Try COUNTIFS() applying few tricks.
=Arrayformula(IF(B2:B="",,LEFT(B2:B,1) & "000" & COUNTIFS(B2:B, B2:B, ROW(B2:B), "<="&ROW(B2:B))))

Related

Google Sheets: Search for matching text within two columns across multiple sheets and return sheet title upon correct match?

Example here.
Hi, I'm new to using formulas in sheets so I apologize for what is most likely a common question, but I haven't been able to find a solution that works for me.
Basically, I have a master sheet filled with the names of various institutions in column B, groups of these institutions belong to different clusters as indicated in the additional sheets of the example I've posted. I need a way so that when the institution's names match, they append either the sheet name or simply the string "Cluster 01", "Cluster 02", etc. to column A. Also, if there are no matches to be found, I'd like it to return as a blank cell.
Thanks in advance!
I previously tried
=if(VLOOKUP('Cluster 01'!B4:B6,B4:B13,1,FALSE),"Cluster 01")
But this isn't exactly what I'm looking for, nor does it work.
You can try with XLOOKUP:
=INDEX(XLOOKUP(B2:B,{'Cluster 01'!B:B;'Cluster 02'!B:B},{'Cluster 01'!A:A;'Cluster 02'!A:A},,0))

How to pick one of the results of UNIQUE() in Google Sheets

Problem
I have a column with duplicate items in Google Sheets, and I would like to get one of the unique values (say, the last one) in the cell of the formula. Is there a way to do this with just formulas (i.e., no scripts/macros)?
What I've tried
Not sure if this is the best way, but I've tried using the UNIQUE(range) function, which returns a list of distinct values, and I tried to pick one with FILTER(range, condition1, [condition2, …]), but I've only managed to do it when I know in advance and hard-code in the number of unique values.
Since I can get the length of the unique list with =LEN(UNIQUE(my_range)), I tried using the REPT(text_to_repeat, number_of_repetitions) function.
For example,
=REPT(0&";",2) & 1 returns "0;0;1"
but
=FILTER(UNIQUE(A$1:A$26), {REPT(0&";",2) & 1})
(or any variation I tried) doesn't quite work.
P.S.
I realise this is not the most suitable problem for a spreadsheet, and I do wish I was using something like Python, but this is the restriction at the moment.
try:
=QUERY(UNIQUE(A1:A), "offset "&COUNTA(UNIQUE(A1:A))-1)
Or more old-school using index:
=index(unique(A:A),counta(unique(A:A)))
You can also just enter a number fot the one you want e.g.
=index(unique(A:A),2)

In Google Sheets, how to list and sum values in some rows but not others depending on string?

I am trying to join gained level for names in a list.
Some names are the same person who has changed handle and the scores should be summed.
I have created a sheet to track levels for players in rankings over time.
My implementation is not as clever as I would like it to be.
Also, there is a problem with some players changing names.
Example Sheet
Currently, I have
=SORT(UNIQUE({}))
In order to produce just one of each name in a list
In the cell next to that I'm using
=IFERROR(INDEX(MATCH())) + IFERROR(INDEX(MATCH())) + IFERROR(INDEX(MATCH()))
to the sum of levels for each name across several ranges /sessions.
In the example sheet, N7 and N10 is the same person but my SORT, INDEX, as well as QUERY cannot handle this. I would like to (manually type in the names as strings that belong to the same person) and that the latest handle is the one used in query output together with the sum of all gains.
Any direction pointers or suggestions as to how I could improve my current implementation or even solve the problem I'm having would be appreciated.
=ARRAYFORMULA(QUERY({Ranking!CF4:CF200\ SUBSTITUTE(Ranking!CG4:CG200; "N7"; "N10")};
"select Col2,sum(Col1)
where Col2 is not null
group by Col2
label sum(Col1)'',Col2'Total levels gained since 15 April 2018'"; 0))
Might not suit you (could mean an extra column per month) but one way would be to to use a lookup table. That is enter whatever name suits you, lookup the 'standard' for that name and drive further analysis off that.

Verifying multiple string match from range of cells

I am using google sheets. My sheet is for scheduling students. There are multiple teachers that teach a subject each hour, and I want to validate a student's schedule by ensuring they have each of the four required classes preset. Math, ELA, Science, and Social Studies. As the example below shows, the scheduler chooses from a drop down list of available classes for each hour. The cell contains the teacher's name and the subject taught. The Validation cell should search across the row for each of the four partial strings "ELA", "Math", "Science", "Social Stud" and return "Good" if all four are present, or "Error" if there is a duplicate, or one missing. Any ideas?
If there is any chance you might change your strings (Math, ELA, etc), I would recommend declaring them as named ranges, and then you wouldn't have to change all the formulas if you change your strings.
I created an example sheet here:
https://docs.google.com/spreadsheets/d/1P9VjIWLQBm9D75caNI1GH4US9buubPj7LpKFe8vLw2M/edit?usp=sharing
Here's the formula I used (though it performs the same basic function as your accepted answer without requiring wildcards):
=if(isnumber(sum(SEARCH(string1,join(" ",B2:E2)),SEARCH(string2,join(" ",B2:E2)),SEARCH(string3,join(" ",B2:E2)),SEARCH(string4,join(" ",B2:E2)))),Good,Bad)
I'm using named ranges for the valid or error responses as well ("Good" & "Bad"). Again, named ranges allow you to change the string on your "Variables" sheet without having to alter the formulas in your Validation cells
You could simply use AND in a IF condition
=if(
AND(
countif(A3:F3,"*ELA")=1,
countif(A3:F3,"*Math")=1,
countif(A3:F3,"*Social")=1,
countif(A3:F3,"*Science")=1,
),
"Good",
"Error")
if you have other validation you can add it to the AND or even add a AND/OR confition inside a condition

Conditional Query and Retrieval

I'm making a Google Sheet for our handyman business and need to collect totals on multiple client labor and material activities. I have a pretty decent sheet going, but, since we work for different clients on different days, with lots of other information in between, it would be nice if I could make a cell collect totals from any cell that has their name at the top of the column instead of chasing all over the sheet to get the client's grand total at the end of the week. Kind of like, if any cell in Row 3 has the word (name) Doe in it, return the value in row 10 of the corresponding column (where the labor for that day has been added up for that client on that day). It'd be great if it could add everything up for that client for the week every time their name is mentioned.
Too much to ask? Thanks for any help!!
If you can standardize the column that the name will occur in you can use vlookup to do exactly what you want. You may need to use partial matches as well if you want only check for part of the name https://exceljet.net/formula/partial-match-with-vlookup.

Resources