Format a column automatically to convert whatever is entered to all capitals - excel-2011

One of the columns in my Excel spreadsheet is just three letter codes that all need to be in capital letters.
So I don't have to worry about making sure each time I enter one of the codes that I have Caps Lock on, how can I make Excel automatically convert everything that I enter in that one column from cell B2 until forever to always be in capitals?

Excel will not convert lower case to upper automatically. The obvious solution would be with something like VBA but since not tagged as such a couple of alternatives are:
Use a caps only font (eg Gothic)
Enter either but then apply a formula for the conversion, eg:
=UPPER(B2)
So whether B2 is entered as abc, or aBc or abC the result would be ABC.

Related

Unable to convert text to Numbers

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.

Locate number string in Excel array?

I have an array of numbers in Excel beginning in B2 as follows:
CA.CAD.CP.0.0.0.0.1.CY
CA.CAD.CP.0.0.0.0.2.CY
CA.CAD.CP.0.0.0.1.0.CY
CA.CAD.CP.0.0.0.2.0.CY
CA.CAD.CP.0.0.3.0.0.CY
CA.CAD.CP.0.0.0.6.0.CY
CA.CAD.OIS.0.0.0.1.0.CY
CA.CAD.OIS.0.0.0.2.0.CY
CA.CAD.OIS.0.0.0.3.0.CY
CA.CAD.OIS.0.0.6.0.0.CY
CA.CAD.OIS.0.0.0.9.0.CY
CA.CAD.OIS.1.0.0.0.0.CY
CA.CAD.ONT.0.0.0.1.0.CY
CA.CAD.ONT.0.0.0.2.0.CY
CA.CAD.ONT.0.0.0.3.0.CY
CA.CAD.ONT.0.0.6.0.0.CY
CA.CAD.ONT.1.0.0.0.0.CY
for several thousand rows. All of them follow this exact format. The numbers represent a date format; D.W.F.M.Y. So 0.0.0.5.0 means 5 months, for example.
I want to find all instances where the date value is "F", meaning all instances of "xx.xxx.xxx.0.0.x.0.0".
What is the best way to do this? I have tried using the FIND function but I think there might be a better way to search for this string.
This will return True/False based on whether the middle, or "F" position is anything but 0 or not:
=--MID(SUBSTITUTE(B2,".",REPT(" ",99)),5*99,99)<>0
With data starting in A2, in B2 enter:
=TRIM(MID(SUBSTITUTE($A2,".",REPT(" ",999)),COLUMNS($A:A)*999-998,999))
and copy across and then down:
Then set an AutoFilter on column G to display non-zero values.
Have you thought to use Word's Find feature? I understand it's in excel - but copy and paste data into Word - it's Find capabilities allow you to search for variables even formatting and special characters including tabs, and punctuation - you can use the Find/Replace feature to have it perform some special maneuvers to mark your text before simply copy/paste special back into excel when finished with Word's special unique features - it's find/replace capabilities are stronger than any other Office program

Which is the correct way of pasting?

I want to ask a very simple and maybe for some it may sound silly.
One person told that while copying and pasting in Excel you should use Paste Special and paste formats first and then values, then it keeps any leading zeros or else they will be removed. But someone else told other way round i.e. first values and then formats. I didn't notice any change also if I pasted as it is after copying.
So please tell me if these people are true and if yes which exactly is the correct order?
Oh, the joy of Excel conversions. You have to be cautious with your different circumstances.
Time to have some fun. Try this:
In cell A1 format the data as Text and enter the value 010.
In cell A2 leave the format as general and enter as 010.
Now go to the immediate window in VBIDE and execute the following:
? Typename(Range("A1").Value)
? Typename(Range("A2").Value)
A1 is a string, and A2 is a double.
If you change the format of A1 now to General then again type:
? Typename(Range("A1").Value)
It is still string - AND it still has the leading 0 at the front!
HOWEVER: now execute the following:
range("A1").Value = range("A1").Value
Although this looks like a pointless command - its effectively updates the cell by using VBA. Excel will now do the conversion to a double!!
? Typename(Range("A1").Value)
This is now a double.
So altering the format after the data can result in different data because Excel is doing a clever conversion. But this is dependant on the cell being updated. Just changing the cell format might change that value, but not necessarily - and later it could change if a user presses F2 and enter on the cell. Lovely - thank you excel for being intelligent.
Don't even get me started with other conversions.
So, I suggest that in the majority of cases, you should actually format first and data after.
Happy pasting! :)
Cell value and cell format are two distinct properties of a cell in Excel.
For displaying values, excel applies the format of the cell to its value. So if your cell holds a number and the format specifies that the number should have leading zeros, the number will be displayed with a leading zero. This does not change the underlying value!
The format affects only the display.
As an example:
Let's say your cell holds the value 5.5 as numerical value. Applying the format 0.00 will display that value as 5.50. Applying the format 0.00 min will display the same value as 5.50 min. But the value itself is still unchanged 5.5 - this way, you can e.g. be very specific about how you want to display a number, but still use its plain value for calculations. Same principles apply to every other formatting rule and data type of course.
So no matter which way round you paste - as long as the cells end up with the correct combination of value and format, you will end up with the correct result.

VLookup not returning the results

I'm not sure why my VLOOKUP formula is not working like the screenshot below. The value is right there as highlighted. I want to output the value in Column G, but changing the 3rd parameter to 1 or 2 doesn't work.
Help is appreciated. Thanks much in advance.
Formula: =VLOOKUP(B2,$F$1:$G$421,2,FALSE)
One thing you may want to look at.
I notice your data is left justified and that's normally the case for textual rather than numeric fields - it's possible to left justify numerics but it's neither the default nor the general practice.
If they are textual, there's a chance one or more of them may have leading or trailing spaces. That would prevent the lookup from finding a match.
Select (in turn) B2 and F1 and use the arrow keys in the formula box to check this is not the case.
In cases like this, I tend to (temporarily) set B2 to the formula =F1 just to see if it can find a match that's guaranteed (then use CTRL-Z to revert).
If that change results in the lookup working then obviously the (original) B2 and F1 are not the same value, and you need to work out why (hidden spaces, wrong types, and so on).
It looks like you are comparing text to number (see the green triangle in your value cell). You have to convert the value in your source cell or matching cells to same type. To convert source to number use excel function such as int or value. Hope this helps.
Another way to convert text to number format is to multiply by 1 and then replace original text values with these new number values...
If you are doing lookup where you have a mix of text and numbers (i.e. looking up a text version of a number in a list of real numbers) you can also make use of the VALUE function... this will convert numbers stored as text to real numbers.
Embed it like so:
=VLOOKUP(VALUE(B2),$F$1:$G$421,1,FALSE)
If you have a mix of text numbers and text text to look up in numbers/text then you can do:
=VLOOKUP(IFERROR(VALUE(B2),B2),$F$1:$G$421,1,FALSE)
to change numbers stored as text to numbers, but leave other text as is...

Excel: Leading Zeros on Dates.. Formula to do it for me?

Is there a way to add a leading zero to a date that is 7 digits and should be 8?
7301982 should be 07301982.
I have a column full of these values, and need a way to do so with a formula. Any ideas?
I know this is an oldie, but when I googled for a solution this was the first result.
What I did was:
=concatenate(year(A1),text(month(A1),"00"),text(day(A1),"00"))
Where A1 is a date field.
=text(A1, "00000000") will do it.
Set a custom format of 00000000
Just another thought since this just happened on my new laptop. It could be your windows settings. If you prefer leading zeroes on the month everywhere in windows (like the lower right hand clock) then you can:
Control Panel >> Clock, etc >> Change Date, Time or Number Formats... then set the Short Date to MM/dd/yyyy.
This also carries over to Excel as the first date format. I know it is not a formula exactly as asked, but this is the article I found while searching.
Simply go to custom for the format of the number and select yyyy\m\d and add more m or d to it.
This is a good formula when you need leading zeros so another application sees a 9 digit number.
Add a column to your spreadsheet (Column B if your data is in Column A)
Use this formula in the new column: =REPT(0,9-LEN(A2))&A2&""
Get the 1st cell, then drag down as much as you need.
Remember to copy/paste option 123 to save as data. Otherwise, you'll see data but in reality it is a formula and you will receive reference errors if you try to use the data in column B.
9 digits and column B are variables. You can use any length or any column on your spreadsheet. Just adjust the formula.
Copied from another answer on a different site, worked for my like a charm!
ok. It seems that your dates are formatted as text. This is what you should do.
first, on a blank cell somewhere on the sheet, type the number 1. then, right click, copy.
next, highlight the entire column of dates. right click, paste special, multiply.
all of the dates will have turned into numbers.
next, highlight the date column, and apply the date format that you want.
There is a simple way to maintain the leading zeroes in Excel.
Simply add this to the cell and type whatever value you need and the zeroes will be retained
For ex: If I want 0000000023
Type into a cell '0000000023
That ' symbol seems to retain the zeroes as long as you type it before the values.
This date format MM/DD/YYYY is available if you select the Locale (location): English (Philippines). Try it with one cell and then copy/paste/special/formats the others.

Resources