I need to make an text string from 7 second last numbers of EAN and additional string..
EAN is here: 8592346106093, so the string what I need is: MJ4610609
I also tried by idea from this article: https://excelnotes.com/how-to-extract-the-second-last-letter/ but doesn't works.. Can anyone help me?
I also tried to setup the columns to General format, text format and number, nothing doesn't work..
As an alternative to Mark Pattison's answer:
="MJ" & LEFT(RIGHT(A1,8),7)
This will give you the leftmost 7 of the rightmost 8 characters of the value in cell A1, prepended with the string "MJ"
If the number 8592346106093 is in cell A1, the the following formula will work:
="MJ"&MID(A1,LEN(A1)-7,7)
The MID function extracts a substring from within a longer string.
Related
How to extract the capitalized full words from a string in excel ? Refer the first Image, I have used the following formula to extract the CAPITAL / BLOCK LETTER WORDS From a string in a cell, it works perfectly,
• Formula used in cell B2
=TEXTJOIN(" ",,
FILTERXML("<a><b>"&SUBSTITUTE(A2," ","</b><b>")
&"</b></a>","//b[translate(.,'abcdefghijklmnopqrstuvwxyz',
'ABCDEFGHIJKLMNOPQRSTUVWXYZ')=.]"))
The above formula works perfectly as longs as there is no numerical, but it doesn't give proper output when there are some numbers, refer the Image below, may be I am missing something, using O365
Refer the cells those green colored backgrounds, it should bring only the CAPITAL WORDS but it carries also the numbers. What should be the right way here. Thank You!
Courtesy : I have learnt & used FILTERXML formula by following the post of JvdV Sir, and it really helped me a lot, Thank you very much Sir for this wonderful piece.!
Workbook_OneDrive_Link
As per the given sample data:
=TEXTJOIN(" ",,FILTERXML("<t><s>"&SUBSTITUTE(A2," ","</s><s>")&"</s></t>","//s[translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', '')='']"))
This would check when all uppercase alpha-chars are translated to nothing the node would equal nothing, meaning all characters were uppercase alpha.
How to extract the capitalized full words from a string in excel ? Refer the first Image, I have used the following formula to extract the CAPITAL / BLOCK LETTER WORDS From a string in a cell, it works perfectly,
• Formula used in cell B2
=TEXTJOIN(" ",,
FILTERXML("<a><b>"&SUBSTITUTE(A2," ","</b><b>")
&"</b></a>","//b[translate(.,'abcdefghijklmnopqrstuvwxyz',
'ABCDEFGHIJKLMNOPQRSTUVWXYZ')=.]"))
The above formula works perfectly as longs as there is no numerical, but it doesn't give proper output when there are some numbers, refer the Image below, may be I am missing something, using O365
Refer the cells those green colored backgrounds, it should bring only the CAPITAL WORDS but it carries also the numbers. What should be the right way here. Thank You!
Courtesy : I have learnt & used FILTERXML formula by following the post of JvdV Sir, and it really helped me a lot, Thank you very much Sir for this wonderful piece.!
Workbook_OneDrive_Link
As per the given sample data:
=TEXTJOIN(" ",,FILTERXML("<t><s>"&SUBSTITUTE(A2," ","</s><s>")&"</s></t>","//s[translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', '')='']"))
This would check when all uppercase alpha-chars are translated to nothing the node would equal nothing, meaning all characters were uppercase alpha.
I've been given an excel to import on Database, it was exported from an Access DB. in the excel there's a column type_class, in one excel it's good(sheet1), but on another excel which I moved to sheet2 to make VLOOKUP function, I can't tell whether it's a text or a number column from the first sight. the upper-left green-thing is not showing on all cells. but, using ISTEXT function result in text. below is the original column without any changes or formatting, as well as ISTEXT result.
when I use the column in a VLOOKUB function to transfer the Name to the first sheet, only (1010, 1101, 1102,....), hence the cells with the green-mark on the upper-left corner.
I can easly format the key in sheet1 using text-to-columns, cell formatting, and any other way.
but I cannot change the column in sheet2, I tried:
Text-to-Columns
Cell Formatting
VALUE(text), CLEAN(text), TRIM(text), TRIM(CLEAN(text)), CLEAN(SUBSTITUTE())
Multiply by 1
but only the cell with the green-mark changes to a number, the rest stays the same. I browsed the internet but didn't get a solution either.
Edit:
I uploaded what is need to test the case on the drive. you can find it here
Help Appreciated
For your digit strings that you can't convert to text, from the comments it seems there are extra characters in that string not removable by TRIM or CLEAN.
Determine what those character are
Assume a "non-convertible" digit string is in A1
Enter the following formula
B1: =MID($A$1,ROWS($1:1),1) and fill down
C1: = UNICODE(B1) and fill down
From this you can determine the character to use in a SUBSTITUTE function.
For example:
From the above we see that the character code that we need to get rid of is 160.
So we use:
=SUBSTITUTE(A1,CHAR(160),"")
or, to convert it in one step to a number:
=--SUBSTITUTE(A1,CHAR(160),"")
Note If the character code is >255, use UNICHAR instead of CHAR in the SUBSTITUTE function.
Without an example, I use value() to convert what excel takes as text like so:
=value(left(“10kg”,2))
Or the following also works:
=left(“10kg”,2)*1
Note those double quotes should be the straight ones - sorry smartphone is not always smart...
And if leading or trailing spaces are an issue, then trim() is one solution.
I want to extract the Test #. and the description that follows into two different columns side by side. Currently I have one long string. I want to break the string into two sets and extract only the needed information.
I have attached a screenshot to make it more clear. In the past I have used the MID function and FIND to extract text from strings, but since the strings here vary in length and content I'm not sure how to do this.
Thank you in advance!!
Formula for cell A9:
= LEFT(A2,FIND(".",A2)-1)
Formula for cell B9:
= MID(A2,FIND(". ",A2)+2,FIND(" .",A2)-FIND(". ",A2)-2)
Drag formulas down as far as necessary.
I want to find the position of the last numeric character in a text string. I'm using this formula to do so:
MAX(IF(ISERROR(FIND({1;2;3;4;5;6;7;8;9;0},A1)),"",FIND({1;2;3;4;5;6;7;8;9;0},A1))
However, this doesn't work if the string contains repeating numbers.
For instance, when the string is "10ABC2010ABC" it will return 6 instead of 9.
When the string is "10ABC2131ABN" it does return 8 instead of 9.
Any ideas what's going on?
Here is working formula:
=MAX(IF(ISNUMBER(VALUE(MID(A1,ROW(INDIRECT("1:" & LEN(A1))),1))),ROW(INDIRECT("1:" & LEN(A1)))))
press CTRL+SHIFT+ENTER to evaluate it.
Explanation:
ROW(INDIRECT("1:" & LEN(A1))) returns you array {1,2,3,...,Len(A1)}
using this array we can take each character in A1 cell: MID(A1,ROW(INDIRECT("1:" & LEN(A1))),1)
using VALUE(...) we tries to convert each character to number. It returns #VALUE! error for all characters exept 1,2,3,4,5,6,7,8,9,0
using ISNUMBER(...) we check whether VALUE(..) returns number or error, and if it returns number, we remember it's position.
final step - using Max(..) we find last position of numeric character
FIND only finds the position of the first instance of each number so it won't work for your requirements. Try using this formula
=MAX(IFERROR(FIND({1,2,3,4,5,6,7,8,9,0},A1,ROW(INDIRECT("1:"&LEN(A1)))),0))
confirmed with CTRL+SHIFT+ENTER
That also uses FIND but the ROW(INDIRECT part starts the search further along the string on each occasion. If there are no digits in A1 you get zero as the result (you could make that an error if you want)
Another possibility if you are using Excel 2010 or later is to use AGGREGATE function like this: [untested]
=AGGREGATE(14,6,FIND({1,2,3,4,5,6,7,8,9,0},A1,ROW(INDIRECT("1:"&LEN(A1)))),1)
That doesn't require "array entry"
See here for sample workbook with suggested formulas
And this array formula will also work... ok, ok... I know it uses offset :)
=1+LEN(A1)-MATCH(1;ISNUMBER(LEFT(RIGHT(A1;ROW(OFFSET(A1;0;0;LEN(A1);1))))*1)*1;0)