简体   繁体   中英

Excel: Use number from one cell to write a string in another cell

I have one column in excel with numbers. I need to use that number to write a string in another cell. For example, Column A has "21" , in column BI need to write a string of 21 0's. Then there should be periods so the total number of characters=40.

Duration    ch
21          000000000000000000000..................
22          0000000000000000000000.................
19          0000000000000000000....................
21          000000000000000000000..................

You can use the REPT() formula to do this:

Assuming your first Duration is in Cell A1

=REPT("0", A1) & REPT(".", 40-A1)

This will repeat "0" as many times as the number in A1 and then will concatenate repeated "." until you have 40 characters.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM