Converting letters to text and back again (Excel 2013) - excel

For a piece of coursework I have to complete a register of student grades. I am trying to calculate their overall grades by converting their grades from each of the four units into numbers (which I have done using the VLOOKUP function), but I need to then convert the result of the average back into a letter. I have used VLOOKUP and also a long nested IF statement to try and accomplish this, but no matter what I can never get a valid result. This is what I have so far (this is just a link to my image as I am unable to post one).
I have converted the Target grade into a number using the formula:
=VLOOKUP(D3,'Grade Values'!A$2:B$11,2,FALSE)
Then added up the total of the different grades from the four units using this formula:
=SUM(VLOOKUP(F3,'Grade Values'!A$1:B$11,2,FALSE)+
VLOOKUP(Dashboard!G3,'Grade Values'!A$1:B$11,2,FALSE)+
VLOOKUP(Dashboard!H3,'Grade Values'!A$1:B$11,2,FALSE)+
VLOOKUP(Dashboard!I3,'Grade Values'!A$1:B$11,2,FALSE))
And then averaged it out with this: =J3/4
The problem I am facing at the moment is that when converting this number back to a letter using the same table as in the second screenshot I get an N/A result when I use this formula: =VLOOKUP(K3,Dashboard!A1:B10,1,FALSE)
I can't seem to figure out what's going wrong with the formula at the end. If anyone can please help me figure this out I will appreciate it a lot. Thank you :)
Edit: I apologise for the irrelevant tags, as far as I was aware formulas in Excel were written in JavaScript.

Personally, I would convert the letter grade to ASCII character using the function:
CODE(A1)
use the ASCII Reference Chart for the integer value of each Upper Case character. Note: A=65, B=66, etc... Perform your calculations, then you can use the function:
CHAR(A2)
to convert the number back into a character.
Example:
A1="A"
A2="B"
A3="C"
B1="=CHAR(AVERAGE(CODE(A1),CODE(A2),CODE(A3)))"

just copy the column A in the sheet dashboard and paste it in column C in the sheet dashboard... so you have
A B C
A* 7 A*
A 7 A
B 6 B
....
the formula you have to use is
=VLOOKUP(K3,Dashboard!$B$1:$C$10,2,FALSE)
remember that this time u need to match a number... not a letter

Related

Dynamically extract string in excel

I have a column called 'cArticle' in excel, containing data in below format. I have a requirement to extract in another column the code that is in brackets. Ex- Z1A,F5C,etc
cArticle
Molecular Dispersion (Z1A)
Acrona Perse (F5C)
Leco Spers (HLP)
Cullar Dipters (LPP)
I have managed to get it partially working by using the below formula, but it still returns with values with the closing brackets. How can I modify it to get the desired results?
RIGHT(cArticle,4)
Thank you in advance!
If the string always ends with (XXX) and the content in the brackets is always 3 digit. You can also try:
=LEFT(RIGHT(cArticle,4),3)
If your code is always at the farthest right and is only 3 characters long, you can use formula as below
=SUBSTITUTE(RIGHT(cArticle,4),")","")
However if your code is not always at the farthest right and may be more or less than 3 characters than you can use formula below, which will work in all cases even if there is no code present
=IFERROR(MID(cArticle,FIND("(",cArticle)+1,FIND(")",cArticle)-FIND("(",cArticle)-1),"No Code")

Finding the right range from excel table

What is the best way to find the right column for the travelled miles using visual basic coding or some excel function and return the price from that column? HLOOKUP can't be used here because the lookup value isn't exact and the ranges in the table are also not with specific intervals (If they were, I could use e.g. FLOOR(travelled miles/100)*100 and find the price with HLOOKUP). Obviously, it's easy to find the price manually with a small table but with a big table computer will be faster.
Note that, if x is between a and b, then MEDIAN(x,a,b)=x. Combine this with some nested IFs:
=IF(MEDIAN(B5,B1,C1-1)=B5,B2,IF(MEDIAN(B5,C1,D1-1)=B5,C2,IF(MEDIAN(B5,D1,E1-1)=B5,D2)))
I'm on my phone, so just done the first three cases, but hopefully you can see how it continues.
(should note you need to remove the dashes for this to work)
Edit:
I also want to answer your question in the comments above. You can use the following to keep the dash, but get a number to work with.
Assume cell A1 has got the value 10-. We can use the FIND function to work out where the - occurs and then use the LEFT function to only return the characters from before the dash:
=LEFT(A1,FIND("-",A1)-1)
This will return the value 10, but it will return it as a string, not a number - basically Excel will think it is text. To force Excel to consider it as a number, we can simply multiply the value by one. Our formula above therefore becomes:
=(LEFT(A1,FIND("-",A1)-1))*1
You may also see people use a double minus sign, like this:
=--LEFT(A1,FIND("-",A1)-1)
I don't recommend this because it's a bit complex, but combining with the formula above would give:
=IF(MEDIAN(B5,--LEFT(B1,FIND("-",B1)-1),--LEFT(C1,FIND("-",C1)-1)-1)=B5,B2,IF(MEDIAN(B5,--LEFT(C1,FIND("-",C1)-1,--LEFT(D1,FIND("-",D1)-1-1)=B5,C2,IF(MEDIAN(B5,--LEFT(D1,FIND("-",D1)-1,--LEFT(E1,FIND("-",E1)-1-1)=B5,D2)))

retrieve part of the info in a cell in EXCEL

I vaguely remember that it is possible to parse the data in a cell and keep only part of the data after setting up certain conditions. But I can't remember what exact commands to use. Any help/suggestion?
For example, A1 contains the following info
0/1:47,45:92:99:1319,0,1320
Is there a way to pick up, say, 0/1 or 1319,0,1320 and remove the rest unchosen data?
I know I can do text-to-column and set the delimiter, followed by manually removing the "un-needed" data, but my EXCEL spreadsheet contains 100 columns X 500000 rows with each cell looking similar to the data above, so I am afraid EXCEL may crash before finishing the work. (have been trying with LEFT, LEN, RIGHT, MID, but none seems to work the way I had hoped)
Any suggestion will be greatly appreciated.
I think what you are looking for is combination of find and mid, but you'll have to work out exactly how you want to split your string:
A1 = 0/1:47,45:92:99:1319,0,1320 //your number
B1 = Find(“:“,A1) //location of first ":" symbol
C1 = LEN(A1) - B1 //character count to copy ( possibly requires +1 or -1 after B1.
=Left(A1,B1) //left of your symbol
=Mid(A1,B1+1,C1) //right size from your symbol (you can also replace C1 with better defined number to extract only 1 portion
//You can also nest the statements to save space, but usually at cost of processing quantity increase
This is the concept, you will probably need to do it in multiple cells to split a string as long as yours. For multiple splits you probably want to replicate this command to target the result of previous right/mid command.
That way, you will get cell result sequence like:
0/1:47,45:92:99:1319,0,1320; 47,45:92:99:1319,0,1320; 92:99:1319,0,1320; 99:1319,0,1320......
From each of those you can retrieve left side of the string up to ":" to get each portion of a string.
If you are working with a large table you probably want to look into VB scripting. To my knowledge there is no single excel command that can take 1 cell and split it into multiple ones.
Let me try to help you about this, I am not a professional so you may face some problems. First of all my solution contains 2 columns to be added to the source column as you can see below. However you can improve formulas with this principle.
Column B Formula:
=LEFT(A2,FIND(":",A2,1)-1)
Column C Formula:
=RIGHT(A2,LEN(A2)-FIND("|",SUBSTITUTE(A2,":","|",LEN(A2)-LEN(SUBSTITUTE(A2,":","")))))
Given you statement of having 100x columns I imagine in some instances you are needing to isolate characters in the middle of your string, thus Left and Right may not always work. However, where possible use them where you can.
Assuming your string is in cell F2: 0/1:47,45:92:99:1319,0,1320
=LEFT(F2,3)
This returns 0/1 which are the first 3 characters in the string counting from the left. Likewise, Right functions similarly:
=RIGHT(F2,4)
This returns 1320, returning the 4 characters starting from the right.
You can use a combination of Mid and Find to dynamically find characters or strings based off of defined characters. Here are a few examples of ways to dynamically isloate values in your string. Keep in mind the key to these examples is the nested Find formula, where the inner most Find is the first character to start at in the string.
1) Return 2 characters after the second : character
In cell F2 I need to isolate the "92":
=MID(F2,FIND(":",F2,FIND(":",F2)+1)+1,2)
The inner most Find locates the first : in the string (4 characters in). We add the +1 to move to the 5th character (moving beyond the first : so the second Find will not see it) and move to the next Find which starts looking for : again from that character. This second Find returns 10, as the second : is the 10th character in the string. The Mid formula takes over here. The formula is saying, Starting at the 10th character return the following 2 characters. Returning two characters is dictated by the 2 at the end of the formula (the last part of the Mid formula).
2) In this case I need to find the 2 characters after the 3rd : in the string. In this case "99":
=MID(F2,FIND(":",F2,FIND(":",F2,FIND(":",F2)+1)+1)+1,2)
You can see we have simply added one more nested Find to the formula in example 1.

How to modify numbers at the end of a cell using a formula

I have cells in excel containing data of the form v-1-2-1, v-1-2-10, v-1-2-100. I want to convert it to v-1-2-001, v-1-2-010,v-1-2-100. I have nearly 2000 entries
If all of the data follows the format shown then you could use FIND to return the position of '-'. There will be three instances of this character and you need to find the third one so use the position given by the first instance as the start position parameter of the second FIND and again for the third (essentially nesting FIND). Once you have the position of the third '-' you know where the final set of numbers are (from the returned third position+1 to the LEN of the string) and could use SUBSTITUTE or a combination of other excel string functions to configure the final portion as you need it.
I'm assuming that excel has your data formatted as text.
If you need further assistance I'm happy to knock up the formula in excel but I'm off to work now and won't be able to do so for around 9 hours.
Please try:
=LEFT(A1,6)&TEXT(MID(A1,7,10),"000")

extract number from a string of text - Excel

I'm trying to pull a number out of the middle of a string of text in excel.
the string is a mixtire of alpha, numeric and some characters.
Example data string:-
Web Address
/products_list.php?retailer=8&cat=43
/products_list.php?retailer=22&cat=43
/products_list.php?retailer=8&cat=1011
/products_list.php?retailer=81&cat=1023
/products_list.php?retailer=147&cat=1224
/products_list.php?retailer=8&cat=1
/products_list.php?retailer=147&cat=4
/products_list.php?retailer=147&cat=401
What i want to achieve is
I got as far as pulling out all the numbers from the text but really couldn't work out how to just get the numbers in the middle or the ones at the end.
My attempted code to fix the issue was:-
=SUM(MID(0&A3,LARGE(ISNUMBER(--MID(A3,ROW(INDIRECT("1:"&LEN(A3))),1))*ROW(INDIRECT("1:"&LEN(A3))),ROW(INDIRECT("1:"&LEN(A3))))+1,1)*10^ROW(INDIRECT("1:"&LEN(A3)))/10)
SCE for an array formula.
If possible, I would prefer a formula over a macro.
oh in case it makes a difference im using Excel 2010.
Retailer (B2):
=LEFT(RIGHT(A2,LEN(A2)-FIND("=",A2)),FIND("&",RIGHT(A2,LEN(A2)-FIND("=",A2)))-1)
Cat Number (C2):
=RIGHT(A2,LEN(A2)-(FIND("cat=",A2)+3))
drag the formula down and
This looks really ugly (I am no excel expert), but it worked with the list you provided.
Formula for retailer:
=MID(A2,FIND("retailer=",A2)+9,FIND("&",A2)-(FIND("retailer=",A2)+9))
Formula for cat number:
=MID(A2,FIND("cat=",A2)+4,100)

Resources