Increment values in a special manner

shaju

Board Regular
Joined
Jul 12, 2004
Messages
80
Office Version
  1. 2010
Platform
  1. Windows
Hi,
I have a number which goes like XXXXX/dd-mm-yy. What I want is that when this number is entered into a cell and then dragged down, the XXXXX part should get incremented by one number each but the /dd-mm-yy should remain the same. Is it possible...???
TIA
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Try:


Excel 2013/2016
A
112345/01-02-17
212346/01-02-17
312347/01-02-17
412348/01-02-17
512349/01-02-17
612350/01-02-17
712351/01-02-17
812352/01-02-17
912353/01-02-17
1012354/01-02-17
1112355/01-02-17
Sheet9
Cell Formulas
RangeFormula
A2=VALUE(LEFT(A1,SEARCH("/",A1)-1))+1&"/"&RIGHT(A1,LEN(A1)-SEARCH("/",A1))
 
Upvote 0
Assuming your number part could start with one or more leading zeroes, place your starting value in cell A1 (formatted as Text), then put this formula in cell A2 and copy it down...

=TEXT(LEFT(A1,5)+1,"00000")&MID(A1,6,16)
 
Upvote 0
If the date is ALWAYS in the dd-mm-yy format

Try

=LEFT(A1,LEN(A1)-9)+1&"/"&RIGHT(A1,8)
 
Upvote 0
Thank You All...............Now the real problem is which method to select....Thank You all once again.
 
Upvote 0
Thank You All...............Now the real problem is which method to select....Thank You all once again.
If your leading number could ever start with one or more zeroes, then the formula I posted in Message #3 is the only formula that will retain the leading zeroes. If the number can never start with a zero, then any of the formulas will work.
 
Upvote 0
Thank You All...............Now the real problem is which method to select....Thank You all once again.

Cheers - happy we were able to find a working solution for you. If it helps to figure out which method to select, the one I posted allows you to be a bit more dynamic with your entry. Jonmo and Rick's solutions are great if you meet the specified criteria they ouline. For Rick's if there are always 5 numbers leading, his will calculate faster and is less complex (edit: and will maintain leading 0's). For Jonmo's, if your date is always dd-mm-yy format, his will be able to iterate a differing length of numbers at the beginning, and again is faster and less complex than mine.

See example below for different example inputs and the outputs of each formula method:


Excel 2013/2016
ABCDE
1Inputs
2123/01-02-1712345/1-2-1712345/01-02-1700123/01-02-17
3MrKowz124/01-02-1712346/1-2-1712346/01-02-17124/01-02-17
4Rick#VALUE!12346/1-2-1712346/01-02-1700124/01-02-17
5Jonmo124/01-02-17124/5/1-2-1712346/01-02-17124/01-02-17
Sheet11
 
Last edited:
Upvote 0
For Rick's if there are always 5 numbers leading
Good point mentioning that because I forgot to. :oops:

The reason I assumed there had to be 5 leading digits is because the OP showed 5 X's (twice) at the beginning of his representation of what should be in the cell.
 
Upvote 0
Channeling my best Horshack impression..

Ooh! Ooh! Ooh! Ooh!!!! Pick Me..

Lol, seriously though.
If it's safe to assume there are no leading/trailing spaces, and the date will ALWAYS be dd/mm/yy, then I think mine will be the simplest and most efficient.
 
Last edited:
Upvote 0
Good point mentioning that because I forgot to. :oops:

The reason I assumed there had to be 5 leading digits is because the OP showed 5 X's (twice) at the beginning of his representation of what should be in the cell.

I got your back, Jack. :beerchug:
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,331
Members
452,636
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top