Unicode Collation Algorithm UTS10-D34 - collation

https://www.unicode.org/reports/tr10/#UTS10-D35
UTS10-D34. Blocking Context: The presence of a character B between two
characters C1 and C2, where ccc(B) = 0 or ccc(B) ≥ ccc(C2).
The notation ccc(B) is an abbreviation for "the Canonical_Combining_Class value of B".
I found this part is very hard to understand.
I am not sure the quote part refer to literal B, C1, C2?
if so then that would be confused. Since "B" < "C".
If B and C1, C2 not refer to their literal meaning. Then It also should be
ccc(B) <= ccc(C2).

Related

Excel Replace an index of characters with an index of corresponding words

I'm attempting to replace an index of characters with corresponding words that are exclusive to those characters.
Example:
R = Red
G = Green
W = White
B = Black
U = Blue
I am aware this can be done with a series of IF statements, but I'd greatly prefer a more streamlined process, especially since I may be adding significantly more characters to be replaced. I should also add that the cell I am referencing to get the original character will only contain that character.
Place your little table in, say E1 through F5. Place the single character value in A1 and in B1 enter:
=VLOOKUP(A1,E1:F5,2)

Compare two cells in excel and return the matching number of Characters

I'm looking for an Excel function, which compares two cells and returns the number of matching characters between those two cells.
I want the function to ignore case, i.e. A = a, B = b, etc.
Example:
A1 = abcdef and B1 = Afcblm.. C1 = 4 (number of matching characters = 4 (afcb)
The function should compare all characters in two cells and then return every character which is present in both cells regardless of the order.
I have created the function below
=SUM(IFERROR(IF(MID(A1, ROW(INDIRECT("$1:$" & LEN(A1))), 1)=MID(B1, ROW(INDIRECT("$1:$" & LEN(B12))), 1), 1, 0), 0))
It does not work when I apply this to above example C1 = 1 and I believe this issue is due to this function comparing characters sequentially.
this will work if entered using Ctrl+Shift+Enter, rather than just Enter
=SUM(IF(ISERROR(FIND(MID(A1,ROW(INDIRECT("$A$1:$A$"&LEN(A1))),1),B1)),0,1))
You will know if it's been entered correctly because curly braces will be placed either side of the formula in the formula bar like this: {=...}
It works by breaking the text in cell A1 into individual letters
a
b
c
d
e
f
it then performs a FIND to check if the letters can be found in cell B1, returning 1 or 0
1
1
1
0
0
1
And finally summing the array completes the process and returns 4 as required
Update
as per Tom Sharpe's suggestion - for case insensitivity use SEARCH instead of FIND:
=SUM(IF(ISERROR(SEARCH(MID(A1,ROW(INDIRECT("$A$1:$A$"&LEN(A1))),1),B1)),0,1))
Just for completeness this would be another way of doing it. It forces each letter in A1 to be compared against all letters in B1.
=SUM(IFERROR(IF(MID(A1, ROW(INDIRECT("$1:$" & LEN(A1))), 1)=TRANSPOSE(MID(B1, ROW(INDIRECT("$1:$" & LEN(B1))), 1)), 1, 0), 0))
If you wanted to find how many distinct letters were in both cells you could use this
=SUM(ISNUMBER(SEARCH(MID("abcdefghijklmnopqrstuvwxyz",ROW($1:$26),1),A1))*ISNUMBER(SEARCH(MID("abcdefghijklmnopqrstuvwxyz",ROW($1:$26),1),B1)))
Both of them are array formulae and have to be entered with CtrlShiftEnter

Excel Basic: Multiple conditions and cases with different output

I have two numbers A1 and B1, and on C1 I want to do the following.
If the number in A1 satisfies a < A1 <= b AND c <= B1 < d, then I want C1 to show success.
If a < A1 <= b is satisfied but not c <= B1 < d, I want C1 to show TOO LOW.
And similarly if c <= B1 < d is satisfied but a < A1 <= b is not, I want C1 to show TOO HIGH.
I initially wanted to use the IF function but I was not quite sure how to split them into cases and I'm sure there is a way. I'm just not too familiar with Excel words and did not know what I am trying to do is called so I could not look for it on my own...
It would be of great help.
Nested if statements along with And is the way to go. Something like:
=IF(AND(1<A1,A1<5),IF(AND(4<=B1,B1<10),"Success","Too Low"),IF(AND(4<=B1,B1<10),"Too High","Failure"))
I arbitrarily picked a = 1, b = 5, c = 4, d = 10 in your problem description and decided that the cases where both conditions fail should be called, well, "Failure"
The logic is as follows, first the condition on A1 is tested. If it is satisfied then the condition on B1 is tested. If it is also satisfied, then "Success" is returned, otherwise "Too Low". At this stage we have taken care of what to do if the condition on A1 is satisfied. If it isn't -- we move on to the Else part of the outer if statement (the second half of the overall formula. We again check B1. If it is true and we reach this part of the formula, we know that we should return "Too High", on the other hand, if B1 still fails the condition and A1 fails it as well, the formula reports a failure.

How to create a code from numbers in MS Excel

I have a requirement to create codes from numbers.
Ex . If we define
A as 1
B as 2
...
J as 9
K as 0
And if a cell has value 499 then the equivalent code "DJJ" should be returned.
First, find the character associated with the number '1' in the ASCII table:
=CHAR(1)
This will give you the character associated with ASCII code 1. Now find the code # for A, and then add that to your result:
=CODE("A")
This will give you the ASCII code associated with the letter "A". If you test it out, you will see that there is a specific ordering to the ASCII table. It goes through lowercase letters alphabetically, numbers in order, and capitals alphabetically (with special characters thrown in everywhere in a specific fashion). This ordering allows you to find the letters of the alphabet which come after "A", simply by adding 1, 2, etc - ie:
=CHAR(A1+CODE("A")-1)
This would give you the character associated with a number found in A1, starting at the point where the "A" character rests on the ASCII table.
Finally, assume that A1 holds a 3 digit number. To put the above into a cohesive formula, we just need to apply it 3 times, once for each character in your word. We can do this with the LEFT, MID, and RIGHT functions, as follows:
=CHAR(LEFT(A1)+CODE("A")-1) & CHAR(MID(A1,2,1)+CODE("A")-1) & CHAR(RIGHT(A1)+CODE("A")-1)
This first takes the leftmost character found in A1 (say, the number 5), and adds it to the ASCII code for the letter "A". It then returns the character which is 4 places to the right of "A" in the ASCII table [5 - 1 + CODE("A")]. Then it does this for the 2nd character found in A1 (say, the number 6). Then it does this for the rightmost character in A1 (say, the number 0).
There is no error checking in this method; it assumes A1 always holds a 3 digit number, formatted without decimals.
Note that this method makes 0 = to A. I'll leave it to you to decide if you want to shift all numbers to the right so that 1 = A and 0 = K.

Excel text formula to extract words separated by semicolons in a field

A field in Excel contains words separated by semicolons, e.g.:
A1 = save;the;national;treasure;for;good
How can I apply Excel text formulas to produce separate words from this field in another fields? E.g.:
A2 should contain a formula to get the first word ("save")
A3 should contain a (different) formula to get the second word ("the")
etc.
However these formulas should hold good even when the value in A1 changes, e.g. if the value of A1 is changed to
A1 = hello;there;how;are;you
Any help in this respect will be highly appreciated.
(The problem is writing a function of my own is not allowed in this case, I have to use original functions like find, search, mid, etc.)
You can create a VBA function to split the fields from this example:
Function ExtractElement(str, n, sepChar)
' Returns the nth element from a string,
' using a specified separator character
Dim x As Variant
x = Split(str, sepChar)
If n > 0 And n - 1 <= UBound(x) Then
ExtractElement = x(n - 1)
Else
ExtractElement = ""
End If
End Function
Then the A2 formula would be: =ExtractElement(A1, 1, ";") and A3 would be: =ExtractElement(A1, 2, ";") and so on
If you have your text to parse in A1 then the following formulas should work
In A2 enter the formula
=IF(ISERROR(LEFT(A1,FIND(";",A1)-1)),A1,LEFT(A1,FIND(";",A1)-1))
In B2 enter the formula
=IF(ISERROR(RIGHT(A1,LEN(A1)-FIND(";",A1))),"",RIGHT(A1,LEN(A1)-FIND(";",A1)))
You can then copy those down as far as you need. Column A grabs the left most word, and Column B displays the remaining string to be parsed. If it runs out of words to parse the formula will display a blank. Column B can also be hidden.
If you can use intermediate formulae, then this will work:
A1 -- save;the;national;treasure;for;good
B1 -- blank
C1 -- =IFERROR(FIND(";",$A1,1+(B1)),LEN($A1)+1)
copy C1 into D1:H1
C2 -- =MID($A1,B1+1,(C1-B1)-1)
copy C2 into D2:H2
Row 1 will display the position of each semi-colon in A1, because it starts looking in the string one character past the semi-colon found in the previous cell.
eg cell E1 searches for a semi-colon in A1 starting at D1+1 =10.
The iferror statement in C1:H1 traps the error which will occur when the search finds no further semi-colons, and returns the full length of string A1, plus 1 for an imaginary semi-colon at the end.
B1 needs to be blank to create an initial zero.
Cells C2:H2 then use the Mid function to copy the section of the A1 string starting one character after the value in each of B1:G1, with length (C1-B1)-1, (d1-c1)-1 etc (minus one to cut out the semi-colon itself)
You should get: 5, 9,18,27,31,36 in Row 1, and beneath those cells the individual words.
Hope this helps.

Resources