How to have 4 digits in a cell regardless of the number

Solved
maxdu.88 -  
Aranud87 Posted messages 277 Registration date   Status Contributeur Last intervention   -
Hello,

I am currently working on the land registry and I would like my value to automatically appear in 4 digits. For example, for parcel 14, I want it to appear as 0014.

Finally, I would like to copy this value while keeping this form to move it to another cell.

Thank you in advance

Configuration: Windows 7 / Firefox 27.0

7 réponses

via55 Posted messages 14730 Registration date   Status Membre Last intervention   2 755
 
Hello,

2 possibilities:
- either you want to keep a number (for future calculations and you right-click on Cell Format then create a Custom format with 0000, Excel will add the necessary leading zeros to the entered value

- or you enter your value as text by typing directly into the cell '0014

Best regards

--
"Imagination is more important than knowledge." A. Einstein
2
Vaucluse Posted messages 27336 Registration date   Status Contributeur Last intervention   6 453
 
Hello
maybe another idea:

=A1&TEXT(B1;"0000")
with the first number in A1 and the one to be converted into 4 digits in B1

best regards

To err is human, to persist is diabolical
1
Aranud87 Posted messages 277 Registration date   Status Contributeur Last intervention   3 299
 
Lu,

I’m not very familiar with Excel, but in Calc from LibreOffice, under cell format, you have "leading zeros"

There you put 4 and as you can see I typed 14, it shows me 0014
I think there must be something like that in Excel:

large format: https://pix.toile-libre.org/upload/original/1395176154.png

--
Simple and community-based
GNU/Linux Mageia :)
0
maxdu.88
 
I have already completed the first method. I created a column by grouping using the CONCATENATE function (I combine the INSEE code + cadastral sector + parcel number); however, the parcel numbers lose their leading zeros.
0
via55 Posted messages 14730 Registration date   Status Membre Last intervention   2 755
 
Ok
So to group, for example with the sector in A1 and the parcel number in B1:
=A1 & REPT("0";4-NBCAR(B1))+B1

Best regards
0
m@rina Posted messages 27335 Registration date   Status Modérateur Last intervention   11 546
 
To make it simpler, you take the second solution from via55, which is to precede your number with ' and in this case, your number becomes text and will not lose its zeros.
You can also start by giving a Text format to the cells and entering your numbers with the 00, they will also remain.

m@rina
0
maxdu.88
 
I would like to work in text format, but the person who gave me this database has the parcel number without the leading zeroes. How can I convert a raw number (167) to a usable text format (0167)?

Finally, the via55 technique doesn’t work because I have a lot of zeroes.
0
tontong Posted messages 2575 Registration date   Status Membre Last intervention   1 064
 
Hello,
Another suggestion that covers a bit of everything.
Column A, which contains the plot number, is set to the custom format "0000".
To concatenate, we use the TEXT function:
=codeInsee&Sector&TEXT(A1;"0000")
0
maxdu.88
 
Hello

A friend gave me a starting idea and I managed to solve my problem, but my manipulation is more complex.

I take the cadastral number, divide it by 10,000, then I use the function =CTXT(Q2;4;TRUE) to get 4 digits after the decimal point, and finally I finish with the function =MID(R2;3;4) to remove the 0 before the decimal point and the decimal point itself.

Thank you for your ideas

Best regards
0
Vaucluse Posted messages 27336 Registration date   Status Contributeur Last intervention   6 453
 
So you haven't read the suggestion from several participants in this thread who have worked hard to dumbly propose to you:

=TEXT(Q2,"000")

which gives you 4 digits as long as you have a number less than 9999 in Q2

And of course to compose a code with P2 and Q2

=P2&TEXT(Q2,"0000")

Too bad!

Regards.
0
Aranud87 Posted messages 277 Registration date   Status Contributeur Last intervention   3 299
 
it's way easier on Libreoffice LOL
0