+ Reply to Thread
Results 1 to 18 of 18

Create a new Column incorporating part of the information from 2 columns + numbers

Hybrid View

  1. #1
    Registered User
    Join Date
    07-19-2022
    Location
    US
    MS-Off Ver
    2016
    Posts
    8

    Create a new Column incorporating part of the information from 2 columns + numbers

    Trying to create a column with the Code numbers of the following sample table:

    PATNO PAT_LAST PAT_FIRST
    009985 Lan Mei
    009986 Sochacki Emilia
    009987 Rodrigues Jose
    009988 Cherilyn Somali
    009989 Rodrigues Maria
    009990 Johnson Oral
    009991 Johnson Tyler

    New Code column need to create\replace for record 009985 should be:
    LANME000 - 8-DIGIST LONG; (FIRST 3-LETTERS OF THE PAT_LAST + 2 LETTERS OF THE PAT_FIRST + 3-ZEROS). All the records must be the same way.
    However, if SECOND record with the same PAT_LAST & PAT_FIRST comes across, then it should be LANME001 (increased by one digit up to 999)
    This is a long table.

    Wondering is this process is possible with excel\SQL statement or any other way?
    Any help will be appreciated.

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,511

    Re: Create a new Column incorporating part of the information from 2 columns + numbers

    Put this in D2 and copy down:
    =UPPER(LEFT(B2,3)&LEFT(C2,2))&TEXT(0+COUNTIF(D1:D$1,LEFT(B2,3)&LEFT(C2,2)&"*"),"000")

    BSB

  3. #3
    Registered User
    Join Date
    07-19-2022
    Location
    US
    MS-Off Ver
    2016
    Posts
    8

    Re: Create a new Column incorporating part of the information from 2 columns + numbers

    Thank you so much for this help.

    It worked perfectly.

    Regards,

  4. #4
    Registered User
    Join Date
    07-19-2022
    Location
    US
    MS-Off Ver
    2016
    Posts
    8

    Re: Create a new Column incorporating part of the information from 2 columns + numbers

    Hello Bradly
    Thanks for the formula you mentioned above, it works but it picks two digits of the B2 cell instead of picking 3 digits, wondering what I am doing wrong.
    Any help is helpful.

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,427

    Re: Create a new Column incorporating part of the information from 2 columns + numbers

    Is 9985 ONLY and ALWAYS associated with Lan/Mei?
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,427

    Re: Create a new Column incorporating part of the information from 2 columns + numbers

    No reply...

    1. A sample Excel file WITH expected answers (see yellow banner - top) would have been helpful.

    2. Maybe this:

    =IF(B4="","",UPPER(LEFT(B4,3)&LEFT(C4,2))&TEXT(SUMPRODUCT(--(LEFT(E$3:E3,5)=UPPER(LEFT(B4,3)&LEFT(C4,2)))),"000"))
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    07-19-2022
    Location
    US
    MS-Off Ver
    2016
    Posts
    8

    Re: Create a new Column incorporating part of the information from 2 columns + numbers

    Thank you so much.

    It worked perfectly.

    Regards,

  8. #8
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,511

    Re: Create a new Column incorporating part of the information from 2 columns + numbers

    Glad we could be of help

    BSB

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,427

    Re: Create a new Column incorporating part of the information from 2 columns + numbers

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please select "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

  10. #10
    Registered User
    Join Date
    07-19-2022
    Location
    US
    MS-Off Ver
    2016
    Posts
    8

    Re: Create a new Column incorporating part of the information from 2 columns + numbers

    Hello:
    Can we add the following into my original request:

    At the same time, the results like these LANME000; LANME001; LANME002; etc. must be assigned based on the entire column (Cell D2 through Cell D2000).

    Thanks,

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,427

    Re: Create a new Column incorporating part of the information from 2 columns + numbers

    Please post a sample sheet showing what the BOTH formula ARE SHOWING and (in another column) what it SHOULD show.

  12. #12
    Registered User
    Join Date
    07-19-2022
    Location
    US
    MS-Off Ver
    2016
    Posts
    8

    Re: Create a new Column incorporating part of the information from 2 columns + numbers

    Trying to create a column with the Code numbers of the following sample table:
    PATNO PAT_LAST PAT_FIRST
    009985 Lan Mei
    009986 Sochacki Emilia
    009987 Rodrigues Jose
    009988 Cherilyn Somali
    009989 Rodrigues Maria
    009990 Johnson Oral
    009991 Johnson Tyler





    New Code column need to create\replace for record 009985 should be:
    LANME000 - 8-DIGIST LONG; (FIRST 3-LETTERS OF THE PAT_LAST + 2 LETTERS OF THE PAT_FIRST + 3-ZEROS). All the records must be the same way.
    However, if SECOND record with the same PAT_LAST & PAT_FIRST comes across, then it should be LANME001 (increased by one digit up to 999). This is a long table.
    At the same time, the results like these LANME000; LANME001; LANME002; etc. must be assigned based on the entire column (Cell D2 through Cell D2000).
    Wondering is this process is possible with excel\SQL statement or any other way?
    Any help will be appreciated.

  13. #13
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,427

    Re: Create a new Column incorporating part of the information from 2 columns + numbers

    And the sample sheet that I requested is... where???

  14. #14
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,427

    Re: Create a new Column incorporating part of the information from 2 columns + numbers

    All you have done is copy/paste the opening post. That is NOT what I asked for.

  15. #15
    Registered User
    Join Date
    07-19-2022
    Location
    US
    MS-Off Ver
    2016
    Posts
    8

    Re: Create a new Column incorporating part of the information from 2 columns + numbers

    Thank you so much Badly and Glenn; both works great, I really appreciate it.

    Is there something can be done on the following enhancement of the same formula?

    PATNO PAT_LAST PAT_FIRST Need to create

    009985 Lan Mei LANME000

    009986 Sochacki Emilia SOCEM000
    009992 Sochacki Emala SOCEM001

    009987 Rodrigues Jose RODJO000
    009993 Rodrigues Josh RODJO001
    009994 Rodrigues Jones RODJO002

    009988 Cherilyn Somali CHESO000

    009989 Rodrigues Maria RODMA000
    009995 Rodrigues Marina RODMA001
    009996 Rodrigues Mari RODMA002

    009990 Johnson Oral JOHOR000
    009991 Johnson Tyler JOHTY000

    Any help will be appreciated.

    Regards,
    VJ

  16. #16
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,427

    Re: Create a new Column incorporating part of the information from 2 columns + numbers

    What's the difference?? Please post them in an Excel file... the forum has messed up your formatting.

  17. #17
    Registered User
    Join Date
    07-19-2022
    Location
    US
    MS-Off Ver
    2016
    Posts
    8

    Re: Create a new Column incorporating part of the information from 2 columns + numbers

    Thanks for a quick response.
    Attached is XLS file, which will provide batter understanding of my question.

    VJ
    Attached Files Attached Files

  18. #18
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,427

    Re: Create a new Column incorporating part of the information from 2 columns + numbers

    Bradly???

    Glenn here.

    Your names in this file are all preceeded by a space " Lan" and " Mei" either remove thme and use:

    =IF(C3="","",UPPER(LEFT(C3,3)&LEFT(D3,2))&TEXT(SUMPRODUCT(--(LEFT(G$2:G2,5)=UPPER(LEFT(C3,3)&LEFT(D3,2)))),"000"))

    or leave them and use:

    =IF(C3="","",UPPER(LEFT(TRIM(C3),3)&LEFT(TRIM(D3),2))&TEXT(SUMPRODUCT(--(LEFT(G$2:G2,5)=UPPER(LEFT(TRIM(C3),3)&LEFT(TRIM(D3),2)))),"000"))

    It's probably better to remove them and use clean data, not dirty data. They'll catch you out sooner or later.

    Finally, any reason you're using the obsolete .xls format instead of xlsx. xls went out in 2007....
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 4
    Last Post: 06-23-2022, 07:18 AM
  2. Extracting part information from a column
    By Rikuslouw in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-28-2020, 04:11 AM
  3. Calculating a task due date incorporating part days
    By JMB73 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-11-2017, 04:05 AM
  4. Replies: 3
    Last Post: 09-30-2012, 01:27 PM
  5. [SOLVED] convert all the information from a part of a column to one cell with macro
    By keis386 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 06-06-2012, 03:37 PM
  6. Replies: 2
    Last Post: 07-20-2006, 03:55 PM
  7. [SOLVED] Create column of common items from information in 4 columns
    By Steve in forum Excel General
    Replies: 2
    Last Post: 04-25-2006, 09:45 AM

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