+ Reply to Thread
Results 1 to 26 of 26

Converting text based on criteria

  1. #1
    Forum Contributor keith740's Avatar
    Join Date
    04-24-2015
    Location
    Racine, Ohio
    MS-Off Ver
    MS365
    Posts
    241

    Converting text based on criteria

    good afternoon forum!

    i have a list of employees (hundreds) split up into 3 teams in column A... they have tags at the end of their name, the tags are -AA,-AB, and - V

    i need column B to display a converted version of the cell to left.

    i need the names with -AA, and -AB in column A to show in column B as: move the tag to the front of name but only with one A,space,-,space,first name,last initial
    example: John Wood-AB would show as A - John W


    The names with V(column A) to show in column B as: move the tag to the front of name,space,-,space,first name,last initial,
    example:John Wood- V would show as V - John W

    Attached is an example and what i am looking for

    I know this is an awkward request, is this possible?

    Ty in advance
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Converting text based on criteria

    Is all your data incosistant like that? Some have have space after the -, and some dont (I dont see any with a space before, but would that be possible too?)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Converting text based on criteria

    Enter this formula in B1 and copy down

    =TRIM(IF(OR(RIGHT(A1,2)={"AA","AB"}),"A - ","V - ")&LEFT(A1,FIND(" ",A1)+1))
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Converting text based on criteria

    OK, I guess it doesnt really matter, try this...
    =MID(SUBSTITUTE(A1,"- ","-"),FIND("-",A1)+1,1)&" - "&LEFT(A1,FIND(" ",A1,1)+1)
    Last edited by FDibbins; 07-25-2015 at 06:42 PM.

  5. #5
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Converting text based on criteria

    a1 =if(RIGHT(A1,1)="V","V- ","A - ")&LEFT(A1,FIND(" ",A1,1)+1) and drag down.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  6. #6
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Converting text based on criteria

    Another variation on the theme: Enter in B1 and fill down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  7. #7
    Forum Contributor keith740's Avatar
    Join Date
    04-24-2015
    Location
    Racine, Ohio
    MS-Off Ver
    MS365
    Posts
    241

    Re: Converting text based on criteria

    Wow, blows my mind how you guys do this... great job everyone... they ALL work perfect!

    with that said, i now have a sheet of formulas that are now showing up blank which were working fine when i was manually entering V and A in column B.

    is there a way around this or would i have to manually enter?

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Converting text based on criteria

    What are those formulas?

  9. #9
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Converting text based on criteria

    Isn't column B where the formulae are? If you overwrite a formula, it is no longer there to do the calculation?

    There is something here that hasn't been explained about column B.

    Can you show us what is happening?

  10. #10
    Forum Contributor keith740's Avatar
    Join Date
    04-24-2015
    Location
    Racine, Ohio
    MS-Off Ver
    MS365
    Posts
    241

    Re: Converting text based on criteria

    here are a few... putting together a dummy file now... will attach

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    =IF(C2=0,"",IFERROR(INDEX(StatsforDay!B$2:B$300,SMALL(IF(LEFT(StatsforDay!$B$2:$B$300,1)="v",ROW(StatsforDay!$A$2:$A$300)-1),ROWS($A$1:B1))),""))
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Formula: copy to clipboard
    Please Login or Register  to view this content.
    =IF(Q2=0,"",IFERROR(INDEX(StatsforDay!B$2:B$300,SMALL(IF(LEFT(StatsforDay!$B$2:$B$300,1)="a",ROW(StatsforDay!$A$2:$A$300)-1),ROWS($A$1:B1))),""))
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor keith740's Avatar
    Join Date
    04-24-2015
    Location
    Racine, Ohio
    MS-Off Ver
    MS365
    Posts
    241

    Re: Converting text based on criteria

    10 minutes... ill have dummy file

  12. #12
    Forum Contributor keith740's Avatar
    Join Date
    04-24-2015
    Location
    Racine, Ohio
    MS-Off Ver
    MS365
    Posts
    241

    Re: Converting text based on criteria

    hmm... now im really confused...

    Works fine in the dummy file but in my original workbook all cells in "Team Data" sheet are empty...
    Attached Files Attached Files

  13. #13
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Converting text based on criteria

    You have probably made a very small typographical error in your formulae. Another possibility is that the source names that were converted are not exactly the same in the real file as they are in the dummy. I suggest copying the formulae from the real file into a separate worksheet with a space before the = so that you can see the formula. Copy the same formulae from the dummy file and paste under the real workbook formulae and see what the differences are. A misplaced , or bracket will make all the difference in the world.

    Seeing that all the cells are blank look at differences in the names because if the names are not correct, none of the formulae on the real worksheet will work as they are based on the names.

  14. #14
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Converting text based on criteria

    If you can't find the problem, upload your real file.

  15. #15
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Converting text based on criteria

    The dummy file works and the main 1 doesnt, but you sent the 1 that works

    hard to say what the problem might be, without seeing what you have

    are your row refs, correct?
    does everything start inteh same row/columns?

  16. #16
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Converting text based on criteria

    I just did a little test on the dummy worksheet. I messed up the names on the StatsforDay worksheet and if there is a problem with the names it would have shown up there immediately. The formulae in the real worksheet have to have a mistake in them.

    These are array formulae, have you entered them properly.....easy to overlook.

  17. #17
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Converting text based on criteria

    I tend to use these versions of the ARRAY formulae because they are more tolerant of starting rows for the formula. I tested these in your dummy worksheet without problem.....who knows they might help but the originals should also work
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Formula: copy to clipboard
    Please Login or Register  to view this content.

  18. #18
    Forum Contributor keith740's Avatar
    Join Date
    04-24-2015
    Location
    Racine, Ohio
    MS-Off Ver
    MS365
    Posts
    241

    Re: Converting text based on criteria

    figure it out, cant believe i missed that.

    there is 1 cell in column A with "1" in it... this seperates employees that worked today from employees that didnt

    1 error was throwing everything off lol

  19. #19
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Converting text based on criteria

    the devil is in the details. Glad you got it resolved and thanks for sharing

  20. #20
    Forum Contributor keith740's Avatar
    Join Date
    04-24-2015
    Location
    Racine, Ohio
    MS-Off Ver
    MS365
    Posts
    241

    Re: Converting text based on criteria

    you guys are awesome... problem solved and works perfect now... ty sooo much for your help... sorry about the mess

  21. #21
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Converting text based on criteria

    Just happy you got it resolved, and thanks for the feedback

  22. #22
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Converting text based on criteria

    Congratulations on figuring it out

  23. #23
    Forum Contributor keith740's Avatar
    Join Date
    04-24-2015
    Location
    Racine, Ohio
    MS-Off Ver
    MS365
    Posts
    241

    Re: Converting text based on criteria

    Hello again Forum... Hope all is well!

    I have ran into an issue and have been trying to figure out for hours now. (Wasnt sure if should start new post or work off this one since its pretty much same problem)

    As many of you know i have 2 Teams... in "column B" Teams are distinguished by an "A" or "V"

    My problem is we recently added a 3rd Team, which i would like to add to column B distinguished as "Z"

    The new Criteria is either "- ZA" or "- ZB" (Both would read as Z in column B)

    My old formula i used, which worked GREAT was:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Anyway i could tweak this formula to recognize new team?

    Any help is greatly appreciated

    Sheet 2 is Expected results
    Attached Files Attached Files

  24. #24
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Converting text based on criteria

    Try this.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  25. #25
    Forum Contributor keith740's Avatar
    Join Date
    04-24-2015
    Location
    Racine, Ohio
    MS-Off Ver
    MS365
    Posts
    241

    Re: Converting text based on criteria

    works perfect... TY again Newdoverman!

  26. #26
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Converting text based on criteria

    You're welcome.

+ 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. [SOLVED] Converting Date Text to Number format to use in a VLOOKUP to polpulate data based by date
    By Rossovich in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 04-08-2015, 10:43 AM
  2. Replies: 3
    Last Post: 12-03-2014, 05:43 PM
  3. [SOLVED] Converting dataset from vertical to horizontal based on fixed criteria
    By LJH2410 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-17-2014, 10:56 AM
  4. Returning text against text based criteria
    By dejathorus in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-19-2014, 04:50 PM
  5. sorting text from one cell into 3 other cells based on text criteria
    By steik in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-14-2014, 06:35 PM
  6. [SOLVED] Look up last Nth Text value within a column, based on criteria
    By mhroberts in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-30-2013, 10:17 AM
  7. Replies: 2
    Last Post: 02-20-2012, 05:59 PM

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