+ Reply to Thread
Results 1 to 25 of 25

stuck in a little project ---> give unique id to papers

  1. #1
    Registered User
    Join Date
    05-24-2013
    Location
    norway
    MS-Off Ver
    Excel 2007
    Posts
    14

    Question stuck in a little project ---> give unique id to papers

    hey all,

    I stuck at my project and I want a little help.
    Last edited by rip4life; 05-25-2013 at 06:03 PM.

  2. #2
    Registered User
    Join Date
    05-24-2013
    Location
    norway
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: stuck in a little project ---> give unique id to papers

    describing the situation:

    Untitled.jpg

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: stuck in a little project ---> give unique id to papers

    Which column contains the dates, and which column will you use for these numbers? Does your data start in row 2 ?

    Pete

  4. #4
    Registered User
    Join Date
    05-24-2013
    Location
    norway
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: stuck in a little project ---> give unique id to papers

    The dates are in the first column - A
    the numbers are (you can look at the photo that i posted):
    1. one is the number of month (i do it already) - i
    2. second is the number of paper (that i want automatically) - j
    3. thirs is a combine of id (number of month + number of paper. for example, 1-2 (second paper in jan). - k

    thank you!

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: stuck in a little project ---> give unique id to papers

    Put this in E2:

    =IF(A2="","",COUNTIF(E$1:E1,"*-"&MONTH(A2))+1&"-"&MONTH(A2))

    then copy down.

    Hope this helps.

    Pete

  6. #6
    Registered User
    Join Date
    05-24-2013
    Location
    norway
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: stuck in a little project ---> give unique id to papers

    hey, works great!!!!

    another little problem -> if a paper is at the first day of the month (01/05/2013) or (01/12/2013) -> he need to be at the previous month, so at his id he need to get the next number in the previous month.

    for example: if the last paper in march is at the number 132-3, and i put a paper with the date of 01/03/2013, he need to get 133-3. thanks!!!

  7. #7
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: stuck in a little project ---> give unique id to papers

    I'm afraid your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  8. #8
    Registered User
    Join Date
    05-24-2013
    Location
    norway
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: stuck in a little project ---> give unique id to papers

    ok arlu1201, i do it.

    i write the problem that not solved yet:

    another little problem -> if a paper is at the first day of the month (01/05/2013) or (01/12/2013) -> he need to be at the previous month, so at his id he need to get the next number in the previous month.

    for example: if the last paper in march is at the number 132-3, and i put a paper with the date of 01/03/2013, he need to get 133-3. thanks!!!

  9. #9
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: stuck in a little project ---> give unique id to papers

    I see that you have added the links to your first post. You can amend the formula like this:

    =IF(A2="","",COUNTIF(E$1:E1,"*-"&MONTH(A2-1))+1&"-"&MONTH(A2-1))

    Hope this helps.

    Pete

  10. #10
    Registered User
    Join Date
    05-24-2013
    Location
    norway
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: stuck in a little project ---> give unique id to papers

    hey,

    works great.

    can you explain me what the formula do?

    thanks.

  11. #11
    Registered User
    Join Date
    05-24-2013
    Location
    norway
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: stuck in a little project ---> give unique id to papers

    another little question for finishing:

    every paper have a year. can i separate the id with the year? write id like this: 820-3-13, 820-3-14, 820-3-12... etc...
    becuse the id goes up with the month of separate year.

  12. #12
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: stuck in a little project ---> give unique id to papers

    You should describe all the requirements at the beginning, rather than drip-feeding them. Try this version to include the year:

    =IF(A2="","",COUNTIF(E$1:E1,"*-"&TEXT(A2-1,"mm-yy"))+1&"-"&TEXT(A2-1,"mm-yy"))

    It works by counting the cells above where the formula is which have any number plus "-mm-yy", and then adding one onto the number followed by "-mm-yy"

    Hope this helps.

    Pete

  13. #13
    Registered User
    Join Date
    05-24-2013
    Location
    norway
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: stuck in a little project ---> give unique id to papers

    HEY PETE.

    you are awesome. sorry for bothering you. after i gave this for the project, i find that i need one small change.

    every date need id with the moth after.
    for example - 02/12/2011 need id for (jan 12).
    for example - 15/06/2013 need id for (july 13).

    01/06/2011 - is still id for the 5 month. he is with the group for example: 27/04/2011 - that goes to may (5).

    get me? thank you a lot! you help me very much!!!

  14. #14
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: stuck in a little project ---> give unique id to papers

    This contradicts what you said earlier, where a date of the 1st of a month should be taken as the previous month.

    Instead of A2-1 (twice) in the formula, which means take the previous day, you should change it to A2+30 (as an approximate adjustment to move to the next month, but 28th Feb would move it into April - how long is a month??).

    I hope this is going to be worth a "star" !!

    Pete

  15. #15
    Registered User
    Join Date
    05-24-2013
    Location
    norway
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: stuck in a little project ---> give unique id to papers

    hey,
    i have some bugs.

    31/01/2012 - goes to 1-03-12 - (id) - instead of 1-02-2012
    01/06/2013 - goes to 2-07-13 - (id) - instead of (next number)-05-2013...

  16. #16
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: stuck in a little project ---> give unique id to papers

    So you are saying that the first of June should still be counted as May, and other days in June should be counted as July? Doesn't make sense.

    Pete

  17. #17
    Registered User
    Join Date
    05-24-2013
    Location
    norway
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: stuck in a little project ---> give unique id to papers

    yes. like checks to the bank.

    25/03/2013 are for april
    31/03/2013 are for april
    01/04/2013 are for april
    13/04/2013 are for may

    01/06/2013 are for june.
    like 15/05/2013 are for june.
    like 15/06/2013 are for july
    like 01/07/2013 are for july.
    get me?

  18. #18
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: stuck in a little project ---> give unique id to papers

    No, I don't get you, but if you are saying that you want a cut-off date each month so that anything after 14th of a month should be treated as the next month then use A2+14 instead of A2+30.

    Pete

  19. #19
    Registered User
    Join Date
    05-24-2013
    Location
    norway
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: stuck in a little project ---> give unique id to papers

    hey pete,

    look at the picture: Untitled.jpg

    look at the date 31/1/2012 -> the id need to be with the month feb - (1-02-12). in the picture he give the paper id with march 1-03-13.

    in the file, it happens only with this date... and this stuck all the papers in feb that get id for (3).

    thanks!

  20. #20
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: stuck in a little project ---> give unique id to papers

    Did you see my last post? Add on 14 instead of 30 (it occurs twice in the formula).

    Pete

  21. #21
    Registered User
    Join Date
    05-24-2013
    Location
    norway
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: stuck in a little project ---> give unique id to papers

    yes i saw it, but thats not good. 07/12/2011 get 1-12-11 instead of 1-01-12. and so on.
    03/02/2011 get 1-2-11 instead of 1-3-11.

    maybe we need new formula? with some if to the day 01 in every month? or something else with the exist formula?

    thanks

  22. #22
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: stuck in a little project ---> give unique id to papers

    Start a new file, put 1st Jan 2013 in A1, then in A2 put this formula:

    =A1+1

    and copy this down to A366, to give you a list of dates.

    Then against each date put the month number that you want that date to be considered in.

    Attach the Excel file (NOT a picture of it), and then I might be able to see the logic behind what you want to achieve.

    Pete

  23. #23
    Registered User
    Join Date
    05-24-2013
    Location
    norway
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: stuck in a little project ---> give unique id to papers

    ok, i did it
    Attached Files Attached Files
    Last edited by rip4life; 05-25-2013 at 06:04 PM.

  24. #24
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: stuck in a little project ---> give unique id to papers

    Okay, try this formula in E2:

    =IF(A2="","",COUNTIF(E$1:E1,"*-"&TEXT(MOD(MONTH(A2)+(DAY(A2)<>1)-1,12)+1,"00")&TEXT(A2,"-yy"))+1&"-"&TEXT(MOD(MONTH(A2)+(DAY(A2)<>1)-1,12)+1,"00")&TEXT(A2,"-yy"))

    Hope this helps.

    Pete

  25. #25
    Registered User
    Join Date
    05-24-2013
    Location
    norway
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: stuck in a little project ---> give unique id to papers

    hey, solved.
    Last edited by rip4life; 05-25-2013 at 06:04 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1