Google Sheets Import Data and COUNTIF? - excel

I am using google sheets and trying to Import Data from another sheet into the current sheet, but looking for this imported data to pull certain values.
For example, I need to know how many incomplete assignments were submitted by males. This is what I have thus far...which is not working. I am getting the answer of 4 when I should be getting 2. "Incomplete" is in column A, Male is in K
For example: =COUNTIF(IMPORTRANGE("Key","Sheet!A:A"),"=Incomplete")*(COUNTIF(IMPORTRANGE("Key","Sheet!K:K"),"=Male"))
Also, I need to extend this further and be able to calculate how many students had an excuse for not completing the assignment. I do not need to know the actual reason, I just need to know if there was an excuse. Not applicable is an option, but needs to be ignored. This is what I have thus far, but it will only recognize the first answer, not the rest.
=COUNTIFS(IMPORTRANGE("Key","Sheet!N:N"),{"Absent";"Illness";"Social Issues";"The Dog Ate It";"On Holidays";"Not Interested";"Bored"})
Any assistance greatly appreciated.
Billy

For the males and incompletes, you can use a filter view:
=COUNTA(FILTER(IMPORTRANGE("Key","Sheet!A:A"),IMPORTRANGE("Key","Sheet!K:K")="MALE",IMPORTRANGE("Key","Sheet!A:A")="INCOMPLETE"))
To return counts of excuses on top of this, you can add the istext() criteria to the existing filter:
=COUNTA(FILTER(IMPORTRANGE("Key","Sheet!A:A"),IMPORTRANGE("Key","Sheet!K:K")="MALE",IMPORTRANGE("Key","Sheet!A:A")="INCOMPLETE",ISTEXT(IMPORTRANGE("Key","Sheet!N:N"))))

There may be a better way, but this works:
=COUNTIF(IMPORTRANGE("Key","Sheet!N:N"), "Illness")
+ COUNTIF(IMPORTRANGE("Key","Sheet!N:N"), "Social Issues")
+ COUNTIF(IMPORTRANGE("Key","Sheet!N:N"), "The Dog Ate it")
+COUNTIF(IMPORTRANGE("Key"),"Sheet!N:N"), "On Holidays")
+COUNTIF(IMPORTRANGE("Key","Sheet!N:N"), "Not Interested")
+COUNTIF(IMPORTRANGE("Key","Sheet!N:N"), "Bored")
+COUNTIF(IMPORTRANGE("Key","Sheet!N:N"), "Absent")
Sorry, I forgot the other part.
=COUNTIFS(IMPORTRANGE("Key","Sheet!A:A"), "Incomplete",IMPORTRANGE("Key","Sheet!K:K"),"Male")

Related

If excel matches 3 values then return 4th

This is my first time posting on any website, so please be gentle lol!
I am trying to figure out what forumula i need to help with the attached tabs;
Main Sheet
Data Dump
Goal: to identify how many blocks are due for each block length, at each selected time for each service type. The current UI we have is really poor. this is more user friendly.
My solution?
in each cell there will be a formula to search each time slot for each service type and return the accepted amount for standard/large vehicles from the data dump CSV.
I'm self taught on excel and know some basic macros and formulas however i have admitted defeat here.
I hope this makes sense. I only need the formula to pick up one service type i can amend to suit where necessary.
Thanks in advance for those who take the time to assist.
Edit - Outcome
datadump2
James

Excel match multiple records from timetable

I just stuck with my school homework, it seems easy, but there is always different errors and mistakes.
Context
All I need is to connect information from 3 pages.
The first one is timetable of trainings.
The second page is "groups"
Players page
Question
1) Here is my first question. How I can put the time from the "timetable" page ?
I tried vlookup with the easiest group "children 5-7" but even this doesnt work.
The problem is that there is many possible times of some groups and I need the answer like "17:00, 18:00 etc" then.
2) The second question is with the page "players".
Firstly I need to match group or coach from page "groups". For children all is simple, but excel dont want to work even with this. But, there is one problem more. In adult group there cant be more than 4 players in one group, that why I have TK1, TK2, TK3 and TK4 - all this are for adult A. and TK11, TK22 etc are for adult B. So when its done we should match court and time from page "groups".
There is my spreadsheet so be free to try it right here. Hope you will help me!
Ref
https://docs.google.com/spreadsheets/d/1PNp60xmHOx_Q1wBc33WrzIaWmeNG5UMhi-4roV7dJXU/edit#gid=1868650910
I try to give you some ideas about how to solve your issues
Question 1:
The issue you have with VLOOKUP is that you cannot search on the left of your lookup value in the reference table. As suggested above by BruceWayne, you may use INDEX/MATCH. Considering the structure of your data a good formula could be:
=INDEX('timetable try here'!B:G,MATCH(A2,CHOOSE(B2,'timetable try here'!C:C,'timetable try here'!D:D,'timetable try here'!E:E,'timetable try here'!F:F,'timetable try here'!G:G),0),1)
In fact I am using CHOOSE() to select the column where your case should match, because your courts are numbers from 1 to 5. You may replace this formula in the column D under the label Time in your sheet named "groups try here". By the way the result that you get is only the first occurrence (in case you see a zero with some decimals figures, remind to change format to hours), so you will not be able to get the list as you like. As far as I know Excel does not have such kind of formulas. What you could do is create a VBA formula by yourself. You can find more details in this other post always here in StackOverflow, where I replied to a similar question with some code. I believe that your case is exactly the same.
Question 2
In this part I just added the last argument to the VLOOKUP and your formula works. So the correct formula should be in cell E2 of "players try here":
=VLOOKUP(D2,'groups dont try here'!A2:C15,3,0)
and in cell F2 (Court) of the same sheet:
=VLOOKUP(D2,'groups dont try here'!A2:C15,2,0)
I believe you need also a formula to pick-up the time in cell G2 (time):
=VLOOKUP(D2,'groups dont try here'!A2:D15,4,0)
These formulas of course works with suitable groups starting with "children". For the others it is not very clear to me what you need. If you have grouped all TK in Adult A and Adult B you need to have some criteria to fill in the other cells from your sheet 'groups dont try here'. Also remind that if you recode the TK1 and TK2 (for instance by adding a new column to be used as key for the VLOOKUP), with VLOOKUP you will always pick up only the first occurrence in the table.
If you need more support, please leave a comment.

Can excel clean up free-text user entry?

any help would be massively appreciated - I'm really stuck on this.
I have a field on a user entered form that asks people what university they've attended which, due to technical limitations on our system, has to be free text.
This invariably leads to hundreds of different entries for each university, which means I have to use filter on excel and comb through thousands of entries and manually unify - lack of knowledge on how to automate this limits it's practical use massively.
Does anyone know a way we can automate this process of categorizing (and then unifying) different entries which refer to the same thing (e.g someone might put UCL, another might put "university of college, London" and another "university of college london" - I need to teach the system that all 3 are the same and then convert it on excel).
I have a list of the exact entries we want for each university, and I'm happy to manually 'teach' excel when a user entry matches one of these, providing it then learns this for the future (so as time goes on, we have to less and less manual unifying).
Happy to clarify anything, and thanks so much for any help.
Rob
Don't become the victim of user mischief.
Assign a unique ID for each valid response and have the users enter the ID.
Yup...
As you said, you need to do some teaching, here's is the teaching table. Basically just fill up as you go along. You might ask what is UOL, sorry i just crack it out, just for illustration.
And then you have the users inputs (column E), plus 5 calculated columns (F:J)
And now the formulae, I'll show those in row 2 only, the rest are just filled down.
F2 = SUBSTITUTE(E:E," ","*")
G2 = VLOOKUP(E:E,A:B,2,0)
H2 = COUNTIF(A:A,F:F)
I2 = VLOOKUP(F:F,A:B,2,0)
J2 = IFERROR(G2,IF(H2=1,I2,IF(H2=0,"Never seen before","Need validation")))
Basically the logic flow is
do the exact match vlookup of user input in teaching table, if found, then thats it and return the unified name. (Column G)
if the above exact match not found, then we'll proceed to use the star like Helper vallue. Count how many times the HELPER value is found in the teaching table. (Column H)
do the exact match vlookup of helper value in teaching table. (Column I, for use with Column H)
If value in column G is not an error, then use it,
else if value in Column H is 1, then VLOOKUP(HELPER) value is good. If its 0, then you haven't teach excel on the name before. If >2, then it means it need your further attention, the VLOOKUP(Helper) value could be wrong as there are more than one matches.
The trick here is the HELPER column. by replacing blank space with stars, the vlookup now become some sort like vlookup of a sequence of keywords. Doesn't matter how the user's input is, as long as some keywords found and the sequence match, the countif and vlookup return the value.
And at the same time, you also submit an IT enhancement request ! :)

How do I fix this Query in my Google Document?

Could not really find much on this issue, and I even had my father, who works with excel all the time, walk away stumped on this one. Hoping you guys could shed some light!
Here is a copy of the document: https://docs.google.com/spreadsheets/d/1dH86E1hZRQMj3UL6n4B81IVEkHS5_djkXhHkOl3LOSE/edit?usp=sharing
So this was made for my Runescape clan for us to determine when users require a promotion; it simply makes things easier for us. I'm pulling the data with IMPORTHTML from a site that already tracks the data, my document just arranges it for our personal use (promotions).
On the right should be a list of just people that need the promotion, however, it seems whoever is first on the column I select with the QUERY (A2:D501, Pea being A2), they get put there regardless if they meet the criteria. In this case, under "General Promotions", they need a Clan XP of 250,000,000 and they must be a Captain rank (it goes Captain -> General), yet the Owner (both under 250m exp and not a Captain), is showing up there and under all categories.
Have no idea why this is happening, so if anyone could enlighten me, I would be greatly appreciative!
All I want is if there are no users who fit the criteria, I can have it say something like "No Promotions Yet". Couldn't figure that one out either.
Does this formula work as you want in cell F3:
=IFERROR(QUERY(A2:D501, "select A,B,D where D >= 250000000 and B contains 'Captain'"),"No Promotions Yet")
You will need to delete the formula you have in columns G & H though - QUERY can output multiple columns rather than needing a separate formula for each one.

Excel - replace a formula cell with its result automatically

I am trying to make a sheet to add to templates that I give to my students for homework assignments; some of them are cheating by sending each other the files and I would like to catch them.
I have made a formula cell that populates with the current OS and directory of the file. What I would like to do is have this become text after evaluation so that if another student opens the file it will not change (but the following cell will, and so on..) Here is the formula:
(Cell A1):
=INFO("osversion")&INFO("directory")
(Cell A2 and beyond):
=IF(A1=(INFO("osversion")&INFO("directory")),"",IF(LEN(A1)<2," ",INFO("osversion")&INFO("directory")))
Do you know if there is any way to have a formula cell be replaced by its value after execution without using VBA? (If I use VBA it asks if you want to enable macros on startup which kind of gives the game away...)
Thank you in advance for your help!
There is a workaround: Use Track Changes. If you are using Excel 2010, for example:
Go to the Review tab and in the Changes group click Share Workbook.
Click the checkbox for Allow changes by more than one user at the same time.
In the Review tab, select Track Changes|Highlight Changes.
You may wish to select All for the When option and Everyone for the Who option.
You can then choose to highlight changes on screen and/or list changes in a new sheet.
If you do that before you make your final changes to the file, you can confirm that nobody has Accepted Changes between the last time you saw the file and the time it is returned to you by checking that your last change is shown correctly.
That will then let you see all the people who have edited the file since you last edited it, and what changes they have made.
(EDIT)
As #Siddharth Rout pointed out in another answer, one can use technological means to make cheating on assignments more difficult but a sufficiently resourceful student can always find a way to circumvent such measures.
This predicament can be resolved by distinguishing two cases:
(a) learning opportunities where students can choose to learn (do the assignment and get feedback on their approach - not a mark) or not choose to learn, and
(b) evaluation processes where one can measure how much they have learned (e.g. by getting the students together under one roof).
In case (a) students are not being evaluated and so have no motivation to "cheat". In case (b), they are being evaluated but have no opportunity to cheat.
Do you know if there is any way to have a formula cell be replaced by its value after execution without using VBA?
The answer to your question is "No, it cannot be done"
Even if you considered VBA as an option, it's futile as this is a classic example of XY Problem.
No matter what you do, you cannot stop your students from cheating. Consider these few scenarios.
Scenario 1
Student A has 1.xlsx. Student B has 2.xlsx. After student A finishes his/her assignment, he/she create a copy of 1.xlsx. Let's call it Copy.xlsx. Now Student A gives Copy.xlsx to Student B. Student B opens Copy.xlsx and copies the answers into 2.xlsx. Once finished, Student B deletes Copy.xlsx and gives you 2.xlsx. So now tell me how will you know Student B cheated?
Scenario 2
Student B calls Student A on mobile. They both have their copies opened. Student A gives all the answers on the phone. How will you know Student B cheated?
Scenario 3
Student A and Student B open files in two laptops next to each other and finish the assignment. How would you know who cheated whose assignment?
Alternative?
Get all the students under one roof and then get them fill it up in front of you. There is no other way you can even guess whether someone cheated unless someone is fool enough to mention other students name in his/her template or copied the answers verbatim.
You could always put some text in a cell location that only you know about and make the text white. You could code your text for each student and lock only the contents of that one cell with a password.
That's what I would do...
You can give each of them a different problem (maybe the same problem with different data). You will detect cheating of any kind by just looking at the results.
Programming or IT is not always the solution, even to programming or IT problems.

Resources