Excel - replace a formula cell with its result automatically - excel

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.

Related

Return the value in the first non-empty cell in the column directly to the left and going upward

I'm all new to VBA and have mostly been trying to modify code after recording macros, so it's all pretty basic and the approach might not be as elegant as some of the stuff I've seen on here. So here we go.
I have coded (by brute force) my data to be arranged like a CAD design tree view with parent products/assemblies and constituent sub-assemblies/parts.
Column E contains Level 0 top assembly Part Number
Column F contains Level 1 items Part Number
... etc all the way to ...
Column M containing Level 8 items Part Number
As an example, cell G112 contains ASSY1; cells H113 to H134 contain its constituent items.
I would like to display in a new column (i.e. Column O) the value of cell G112 (ASSY1) for each of its constituents. So O113 to O134 would show the value of G112. That would need to be applied to every single level of the assembly.
I'm not sure I'm making much sense do please have a look at the picture linked below, it speaks a thousand words. I've highlighted and colour-coded the result I would like in column O.
ADDENDUM - To clarify things:
I don't know how else to explain my request but to post a simplified version of my original picture.
SIMPLIFIED EXCEL TABLE
.CSV available here WeTransfer
A very useful tool to retrieve VBA code for determined action is the macro recorder, in the ribbon, Developer -> RecordMacro, perform you action and stop recording and then you can check the code generated for the actions you recorded. Its not the cleanest code but you can find there the lines of code for the specific actions you want. Once you step into a one concrete problem with the code you tried, you can then ask for help regarding something more concrete, more than expecting that someone will code that for you.
Anyhow if you want someone to try to solve your problem, you need to post the table with the accessible data instead of the image, for the person whoever tries to approach your problem to have the data available.
Hope that helps
Here's the answer I got from somewhere else if anyone is interested:
Formula in Cell O3:
=IF(C3=0,"N/A , ALREADY TOP LEVEL",INDEX(D$2:D2,AGGREGATE(14,6,(ROW(D$2:D2)-ROW(D$2)+1)/(C$2:C2=C3-1),1)))
Copy/Paste down in every cell in column O

Select filtering and applying quantity amount to listed percentages

I tried to search but didn't find anything that was exact to what I was looking for. Let's say that I have the Investment$$ and I want to allocate that amount to only Items = to Toy Story and where Character begins with TS. The Investment $$ should only be applied to "Toy Story" and where character begins with "TS".
Apologies on not being able to embed the pictorial example to this message.
I need to write this in VBA. My questions is, is the best way to do this through a vlookup (programmed via VBA)? I want to avoid having the $1000 applied to the wrong movie title and even when it is applied to the right one (Toy Story) I want to make sure it's applied to the right ("TS") ones.
I'll also experiment on my end as well.
Pixar Movie Example
No need for VBA here. You can go with a plain vanilla Excel formula.
What you need in this situation is a key/ID item for your VLOOKUP - how you make that key is up to you, but with it you can easily utilize VLOOKUP. See my below example:

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 ! :)

Excel nested if formulas

I've currently got a Uni project underway and part of this project is an excel spreadsheet which involves inputting data (to be later to be outputted).
Anyway, I don't have too much experience with Excel or programming at all, and I've come across a situation where I need some help.
The project involves building a climbing frame, using EITHER the material Wood, Steel or Aluminium.
In the input table, I have added a "Material Quantity" row where a user can select the material they would like to use (from the above list), and then the amount of material they want to use.
The problem is that the materials Steel and Aluminium can ONLY be provided in increments of 6 metres, while Wood can only be provided with an increment of 1 metre.
As you can guess, I want to create something where a user can select their chosen material and then ONLY be able to enter a amount with the same multiple of what it can be provided in. For example, if a user selects "Steel", they can only enter a value with a multiple of 6m - if they enter, for example, 10m, then I want it to return a error.
After some reading, I think the way to solve this problem is to use a nested IF statement with a MOD command too. If anyone can help me with the forumla it would be much appreciated.
The attached picture is what I've acheived so far (and an idea for you guys to see what I'm dealing with). I really have no clue how to approach the problem :(
Use this formula:
=OR(AND(E8="Wood",MOD(F8,1)=0),AND(OR(E8="Steel",E8="Aluminium"),MOD(F8,6)=0))
Another option would be to allow the user to input the exact length of material and then calculate the amount they will need using the 'MROUND' function.
=IF(OR(E8="steel",E8="aluminum"),MROUND(F8,6),IF(E8="wood",MROUND(F8,1),"Not valid"))

Resources