I am trying to find a way to show growth in comparing letter grade levels. I've been trying to find a way to use the letters to represent numbers (a=1, b=2, c=3, etc) and then subtract one letter grade from another (ex. H-F=2 Levels). I've tried using lookup and if functions but I can't figure it out.
Use code:
=CODE(UPPER("H")) - CODE(UPPER("F"))
You can replace the letters with cell references:
=CODE(UPPER(A1)) - CODE(UPPER(A2))
Related
I know how to count a series of keywords in Excel. I use this formula:
=SUMPRODUCT(--ISNUMBER(SEARCH($CE$2:$CE$43,(G2:AP2))))
However, what would be the Excel formula if I want to count the number of keywords that exist only within +/-3 words around "risk" in the selected rows?
Consider this sentence: "Political uncertainty generates economic risk which stagnates economic activities." If my keywords are political, uncertainty, stagnates, and economic, the total count of keywords within +/- 3 words around "risk" will be 4, i.e., uncertainty, stagnates, and economic. "economic" appears twice in the sentence. political will be excluded since it is out of range.
You could try:
Formula in E1:
=SUM(--ISNUMBER(MATCH(FILTERXML("<t><s>"&SUBSTITUTE("a a a "&A1," ","</s><s>")&"</s></t>","//s[following::s[4]='risk']/following::*[position()<8]")&"*",C1:C4,0)))
This would in order:
"<t><s>"&SUBSTITUTE("a a a "&A1," ","</s><s>")&"</s></t>" - Create a valid xml-string to process with xpath;
"//s[following::s[4]='risk']/following::*[position()<8]" - A valid xpath 1.0 expression to retrieve only upto seven nodes with risk in the middle. In more detail: //s[following::s[4]='risk'] will get the node where the following sibling on 4 indices to it's right will equal risk (case-sensitive), we then take all following siblings from that position with /following::* where we limit the returned nodes to a max of seven with [position()<8]. Now it would also make sense why we concatenate a a a with the string from A1 since risk could appear at the start of the string or less then three words in;
MATCH() - Will then check if any of the returned nodes start with any of the words in C1:C4 using a wildcard. This is to prevent possible punctuation to avoid matching;
SUM() and ISNUMBER() prepended with double unary will lastly make a summation of hits.
Note: The answer is not 3 but 4! Since 'economic' is to be counted twice.
You may try the following formula if you have Microsoft-365 with most recent release.
=LET(x,TOCOL(TEXTSPLIT(A1," ")),y,MATCH("risk",x,0),z,INDEX(x,SEQUENCE(y+2,1,y-3)),COUNT(XMATCH(D1:D4,z,0)))
I only have one column that has an 8-digit number. No dots, commas or any conjugation. Only integers.
I simply want to extract the first integer from the number and put it to a new column named "First integer". I want the rest of the integers, untouched, to either go to a new column as they are, or stay in the existing column but without the first integer
for example now I have: columnA: 23456789
I want First Integer:2 columnA: 3456789
I am pretty new to Alteryx so that might even be a ridiculous question to some :P
But any help is greatly appreciated :)
Suppose [i] is the relevant numeric field in your Alteryx workflow.
Then using a Formula tool, this expression will give the first digit:
[i]/POW(10,FLOOR(LOG10([i])))
And this will give the remaining digits:
MOD([i],POW(10,FLOOR(LOG10([i]))))
Explanation: working inside-out: Log10([i]) tells you how many powers of 10 you're working with, FLOOR just rounds that off, POW(10,...) multiplies it back out... so basically for an 8 digit number, this gives 10,000,000. Then you simply divide to get the first digit, or take the MOD (modulus) to get the remaining digits.
PS, your question mentions an 8-digit integer... if you are absolutely certain that your integers always have 8 digits (and the first digit is not a zero), then you can shortcut this: firstDigit=[i]/10000000 and remainingDigits=MOD([i],10000000).
I have a string of letters and numbers, where if the second two characters of the string equal a certain value, then a location value should be shown in the corresponding column.
I have used the MID function to essentially extract the characters of the string that I want to use MID(A2,2,2) but now I can't figure out how to compare what is returned to a list of options that those two characters could be without typing in each option in an extremely long formula.
Here are possible strings that are situated in a column:
3PH356969
MSFFACEBUS
MBH0007398
MBH0007402
I am extracting the second two characters of these, to compare to a list similar to this
PH
SF
BH
PG
HR
These values then correspond to location (below), which would optimally be returned:
Philadelphia
Bay Area
Birmingham
Western PA
Hartford
I can write =IF(MID(A2,2,2)="PH","Philadelphia",else...) but then the else-ifs will go on for 76 more 2-character strings to compare against. I'm hoping there is a more optimal way for this.
Expected results should be the location corresponding to the string, or just "error" displayed.
Basically we need to use a lookup/reference table, but instead of a much more common VLOOKUP function we can use a much faster INDEX + MATCH combo.
Formula in B1:
=INDEX($E$1:$E$6,MATCH(MID(A1,2,2),$D$1:$D$6;0))
I would use a VLOOKUP, personally. Although it would require a separate lookup table, just feed your MID result as the VLOOKUP key. Then you could easily add/remove locations, and there will be an #N/A error if the key's not there.
If you don't want a separate lookup table, you may try it this way:
=IFERROR(INDEX({"Philadelphia","Bay Area","Birmingham","Western PA","Hartford"},MATCH(MID(A2,2,2),{"PH","SF","BH","PG","HR"},0)),"Not found")
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
In my country any bank account number has a secondary key which named SHEBA, and there is formula to calculate the SHEBA from account number.
For example if my account number is 801-800-125954-1, the SHEBA of this number is IR0008010080000125954001.
As you can see, changing the account number to SHEBA has been done by putting a handful of zero between account number's digits (however It's not always so simple).
So, I want write formula in Excel that can put zero - or any other digit - between our Number of customer accounts.
I mean, write function in which it's input is a number and output is same number plus some another digit between number
If you can split your string after each '-', you can pad each one with the appropriatz number of '0'.
Se "Add leading zeroes/0's to existing Excel values to certain length" (using TEXT)
801 would become "IR"+TEXT("800","000000")
Since you only posted one number and one SHEBA, it is a bit hard to establish a pattern, especially if, as you say "It's not always so simple".
You can use one formula to get from your number to your SHEBA
="IR000"&SUBSTITUTE(A1,"-","00")