How to split number by hyphen - excel

How could i split a number on this format: xxxxxxxx to this xxxx-xxxx in excel?

I would like to start by stating that I believe Ron Rosenfeld's comment to be absolutely correct. Adding a dash to the number does two things:
Changes it from being a number to being text
Increases the amount of information that needs to be stored
you are usually far better off changing the display formatting than actually inserting the dash/hyphen between the first and last 4 digits.
Having said that, if you have a reason to actually insert the dash, you can use the following formula assuming your Data is in A1. Place the formula in your required cell and copy down as necessary:
=LEFT(A1,4)&"-"&RIGHT(A1,4)

Related

How to set a Child-Parent system?

I have an Excel file which includes lots of rows of information. I have actually a single problem which is I can't get the parent of each cells according to the information in the cell. It looks like this
In the image, you can see that A has no parent and its' children are A01 and AB and more and more like AC and AD. Is there any way for handling this issue with excel-formulas?
Assuming that your sample data is true to the format of all your data (there is either 2 numbers at the end of each parent or only an extra letter) then the following formula will work:
Given formula is set to look at data in cell A1, you will have to drag and auto fill the formula down for all rows.
=IF(OR(RIGHT(A1,1)="0",RIGHT(A1,1)="1",RIGHT(A1,1)="2",RIGHT(A1,1)="3",RIGHT(A1,1)="4",RIGHT(A1,1)="5",RIGHT(A1,1)="6",RIGHT(A1,1)="7",RIGHT(A1,1)="8",RIGHT(A1,1)="9")=TRUE,LEFT(A1,LEN(A1)-2),LEFT(A1,LEN(A1)-1))
It works by checking if the last character is a number (with this data excel treats it as text so we have to check for each number as if it is text), if it matches a number then show the parent minus the two right characters otherwise show the parent minus one character.
Okey I think I found the answer. Here is my formula
=IF(LEN(B2)=1;"NULL";IF(LEN(B2)=2;LEN(B2;0);IF(LEN(B2)=3;LEFT(B2;1);IF(LEN(B2)=4;LEFT(B2;3);IF(LEN(B2)=5;LEFT(B2;4);IF(LEN(B2)=7;IF(B2;5)))))))
With this formula, I check the length of the characters in cell and get the first part of that string instead of deleting the last indexes because of there are also some string values.
Because of there are some rules with my product codes, I figured out how they are changing and I got the part of the code by their sizes. Thanks for replies, they helped to find this solution.

Excel Number like a certain number Replace

Excel is trying to "smartly" change certain numbers in my formula for me.
Some of which make sense, some of which do not.
Is there a fast way I can do a number replace for any number that is close to the number I want to replace?
Example:
All these numbers I want to replace to A2:A2000:
A8:A2006
A9:A2007
A10:A2008
A11:A2009
Is there a fast way I can do that with control+H?
Scott Craner's reply is the answer:
in your first formula you would lock the reference by making it absolute using the $ notation: $A$2:$A$2000 now as the formula is dragged/copied down or over the reference will remain the same. –

Excel Custom Formatting and/or Formula

I have a list of numbers for a client like below:
8481.80.9005
8481.80.9005
8413309090
8413309090
The first two numbers exhibit the correct formatting, per the client. Is there a formula and/or custom formatting that I can use to make all numbers uniformly the correct format?
Note - all numbers are 10 digits with periods after the fourth and sixth digits.
I know I'm going to be shot down on this one, but couldn't see why you can't do
0000\.00\.0000
in custom formatting
The problem with a custom format is that Excel will read the number as a whole number and any attempt at putting in the ., if your local settings are set to the . being the decimal separator, is that it will try to put it at the end.
So we need to first make it a string with some other separator and then do a substitute.
The following formula does that:
=SUBSTITUTE(TEXT(A1,"0000-00-0000"),"-",".")

Adding additional numerical values into already made column

Major noob here. This is my dilemma:
I created a spreadsheet on excel and input my data in a column. Then I was informed that I need to add two zeros (00) to the front of each value. Is there a way of doing this on excel w/o me double clicking each row and manually adding the 00's before the original value?
in order to add two leading zeros to numbers of unknown length, the only viable option I can think of is to turn the number into a string.
="00"&A1
There may be a way with the format text function to measure the length of your number then format with two leading zeros but that is currently beyond me.
The other option is to go into the custom cell format and change the display to
000000
Where the number of 0s is two longer than the number of digits in your number. If your numbers are inconsistent in length you would need to do this for each cell. It would keep the number as a number though.
Thanks for your replies. #Forward Ed your idea gave me a diff idea. I just added the 00's to the column before and then used another column + the CONCATENATE function.
Also for fellow cavemen like myself, you can use notepad to do it the ghetto way and copy then re-paste back to excel -.-
Im such an idiot lol. Thank you

How to add cells with mix of 6 to 8 decimal places together

Because of floating point values, I cannot add a string of cells that contain values such as:
0.08178502
0.09262585
0.13261762
0.13016377
0.12302067
0.1136332
0.12176183
0.11430552
0.09971409
0.125285
Even if I try adding the first two through a sum formula or auto sum through selecting them, excel spits out an error. I have googled this like crazy and tried to change number formats. Is there a function that can allow me to add this information ?
Screenshot:
The spreadsheet is available on my Dropbox.
Those numbers are all preceded by a NBSP (Char Code 160). So, in order to sum them, you have to remove that. Many solutions. Here's one:
=SUMPRODUCT(--SUBSTITUTE(A1:A18,CHAR(160),""))
If a formula like:
=A1+A2+A3+A4+A5+A6+A7+A8+A9+A10
produces:
#VALUE!
then your "numbers" cells contain non-visible characters.
They must be removed before the formula will work.
If the cells contain text strings and not actual values you will need to convert the text to numeric values before performing any calculations. The function "=value(cell)" will bring the numeric value.
e.g.: A1 contains "000.12345678" (or some other non-numeric presentation of numerals)
In cell B1 type: =value(a1)
Cell B1 now operates as the real number 0.12345678
Oddly enough, the fact that it said 0.xxxxx in all numbers vs. .xxxxx is what the issue was. I'm just sharing that for folks who google/search and have same issue.
All I had to do was select that whole row and do a search in replace for "0." and make it just "." and now my numbers were usable in equations. For some reason the adjustment of formating as many searches suggested wasn't working

Resources