I have a column where I would like to enter a string of 10 characters (either numbers or letters or mixed), i.e. XXXXXXXXXX, that is displayed as XXXXX-XXXXX. If I only type in numbers, I know that I can use the custom number format 00000-00000, but I can't seem to get it to work with letters also. I've tried adding a # in the number format code at different places with no luck.
If possible and if the input is only 5 characters long, i.e. XXXXX, I would like for the cell to be able to automatically add a predefined prefix, YYYYY, so that the cell now contains the string YYYYYXXXXX and displays it as YYYYY-XXXXX.
That is, the column only contains strings with the length of 10 characters and they are all to be displayed as XXXXX-XXXXX. If I input 5 characters, then the cells in the column should add YYYYY as a prefix, if possible. However, the first part of my problem is the most important.
Related
I have data in notepad with more than 1000+ entries, which need to convert in to Excel with particular break based on length. can someone help
011000015FRB-BOS FEDERAL RESERVE BANK OF BOSTON MABOSTON Y Y20040910
File format is as below
Position Field
1-9 Routing number
1 Office code
I tried delimiting option but dint worked out.
If your data always has the routing number in columns 1-9, then delimited import is the way to go. Choose Import From Text, then select Fixed Width and click Next. On Step 2, click at each character that would be a separator. Eg, click at character 9 to split it into two columns with the first column haviong the first nine characters and the second column having the rest. Step 3 will allow you to set the data format. I'd recommend setting the first column to text so Excel doesn't try to use scientific notation or something on your account numbers.
If I have entered a certain 4 digit number for example ,1234 how do I choose like the first 2 numbers or the last two numbers from the cell by that i mean suppose i want it to return 34 for the last two digits and I want it to return 12 for the first two digits. So anytime I change my 4 digit number it works the same way.
You may use the LEFT and RIGHT functions, e.g.
=LEFT("1234", 2)
=RIGHT("1234", 2)
If your 4-digit number is, in fact, a string you can parse the string as suggested by #Tim Biegeleisen. In my Excel 365, when I enter 1234 in a cell formatted as General I can use the same method.
=LEFT(A1, 2)
and
=Right(A1, 2)
However, this conversion of a number to text mustn't be presumed to work under all circumstances. Therefore you may prefer to convert the number to text explicitly in the formula.
=LEFT(TEXT(A1,"0000"), 2)
and
=Right(TEXT(A1,"0000"), 2)
This method has the added advantage of being able to handle numbers of less than 4 digits.
On the other hand, you can also extract first and last digits from a true number, without converting it to text.
=INT(A1/100)
and
=MOD(A1,100)
The main difference is that the results are also numbers (all partial strings are text). Therefore this would be the preferred method if you don't want to worry about strings, text, numbers, numerics and cell formats.
I want to force users to enter data in a specific cell in a sequence like ABCDE1234F
i.e. first five characters must me letters then four digits and last must be a letter using custom data validation.
It is quite long:
=AND(ISNUMBER(SUMPRODUCT(SEARCH("~"&MID(A1,ROW($1:$5),1),"abcdefghijklmnopqrstuvwxyz"))),ISNUMBER(SUMPRODUCT(SEARCH("~"&MID(A1,ROW($6:$9),1),"0123456789"))),ISNUMBER(SUMPRODUCT(SEARCH("~"&MID(A1,10,1),"abcdefghijklmnopqrstuvwxyz"))),LEN(A1)=10)
It goes through each of the required text characters and checks if it is a number or a string. Then it test the full range of numbers for text. It also ensures that it is ten characters long.
You may try following formula
=AND(ISTEXT(LEFT(A1,5)),ISNUMBER(MID(A1,6,4)*1),ISTEXT(MID(A1,10,1)),IF(LEN(A1)=10,TRUE,FALSE))
On a daily basis I need to load data to one of our systems. However Excel deletes the previous zeros in front of the contractor IDs. So i have to add THREE zeros manually. I normally use the CONCATENATE function however now the IDs are coming differently so some IDs now only need to have TWO zeros added.
example:
ID
911111
I use concatenate to make it look like:
000911111
I came up with the IF formula that detects if the ID starts with a number NINE, to concatenate TWO zeros and if not, then to add THREE zeros.
example:
=IF(LEFT(A32,1)="9",CONCATENATE("00",A32),CONCATENATE("000",A32))
Now I want to create this formula as a custom defined so I do not have to write down the formula ever time I work on the data every day.
Any suggestions I will really appreciate.
In addition to the formatting responses provided in the comments, you could use the RIGHT function to cut off the leading zeroes to the appropriate amount.
For example, assuming A1 holds a string of numbers, between 0 & 9 digits long. We can create text representing a 9 digit string, with as many leading zeroes as necessary, as follows:
=RIGHT(REPT("0",9) & A1,9)
REPT("0",9) tells Excel to repeat the character "0" 9 times. It then tacks on whatever text is in A1. Then it takes only the rightmost 9 characters of the concatenation.
I generally would recommend the Formatting options noted in those comments, unless you need the text to be 9 characters for other formula purposes.
I have set up an advanced filter in Excel. I can not get the advanced filter to produce any output when using wildcard asterisks (*), using a source list that contains numbers and hyphenated numbers, OR alternatively when using a separate list which is producing a number from a formula. All adv.filter headers are properly placed and named; the filter works fine not using wildcards.
Original List:
10
10-1
11
11-1
100
I am using a formula to convert these hyphenated numbers to ignore the dashes so they will sort properly (smallest to largest) in my list:
=IF(A1="","",IFERROR(VALUE(LEFT(A1,FIND("-",A1)-1)),VALUE(A1)))
This results in a secondary column (which is the advanced filter source data):
10
10
11
11
100
My advanced filter criteria then becomes *10* with wildcards, with the output header being the original list with dashes included. I am expecting the wildcard to show both 10 and 100 in the output when user types in 10. There is no output data, however, when using the wildcard. There is exact match output data when I just type in 10 with no asterisks.
Any ideas for why wildcards aren't working? I tried formatting the source data and criteria data as both text, number, and general; none made any difference with wildcards. Thanks for the help!!!!
You had the right idea when you tried formatting as text: wildcards don't work on numeric values.
Where you're running into trouble is that formatting as text doesn't change numbers to text retroactively; only numbers entered after the format change get converted. Instead convert your data to strings first using the TEXT function in another location, and then filter that result.
Depending on exactly what you're doing with the VALUE function in your formula, you might even be able to use TEXT in there.