+ Reply to Thread
Results 1 to 7 of 7

VBA - to find the highest letter, mix with letters and numbers.

  1. #1
    Registered User
    Join Date
    02-23-2021
    Location
    Edmonton, Canada
    MS-Off Ver
    Excel 2016
    Posts
    30

    VBA - to find the highest letter, mix with letters and numbers.

    Hello

    I have tried to figure out how to do this but I can not manage myself.

    When sales staff enter Quote in the system (SAP) we get an number example 1008307-A, if we do a change or an update to the same quote we get 1008307-B, same numbers but -B instead of A, every time they update the quote we get a new letter and when I try to run a report, I get them all in Excel but I would only like to see the "highest" Letter of the Quote.

    I would have this in column E for example

    1008382-A
    1008382-B
    1008382-C
    1008485-A
    1008485-B
    1008623-A
    1008623-B
    1008951-A
    1008951-B

    SO I would just like to show the in bold.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: VBA - to find the highest letter, mix with letters and numbers.

    Hi TAllan and welcome to the forum,

    Here is an answer without needing VBA. It uses two helper columns and a Pivot table to get to your answer.
    First, extract the number, without the letter to a new column. Then sort the data from Z to A. Now add the CountIf() formula helper column.
    I finish off by creating a Pivot Table where the count is the columns and only shows the first (last letter added) orders. See it in the attached file.
    Print Last Order letter added.xlsx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    02-23-2021
    Location
    Edmonton, Canada
    MS-Off Ver
    Excel 2016
    Posts
    30

    Re: VBA - to find the highest letter, mix with letters and numbers.

    HI MarvinP

    Sorry but it did not work so good with a pivot table and I might not been so clear with my question. Sorry about that.
    I attached an example of my Excel sheet and the numbers in RED is the once I would like to just keep the "highest" letter, for each one.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,551

    Re: VBA - to find the highest letter, mix with letters and numbers.

    This proposal employs three helper columns and a pivot table.
    The first helper column is populated using: =IF(ISNUMBER(LEFT(F3,1)+0),LEFT(F3,SEARCH("-",F3)-1)+0)
    The second helper column is populated using: =IF(ISNUMBER(J3),SUM(J3*100,CODE(RIGHT(F3,1))+0))
    The third helper column is populated using: =K3=AGGREGATE(14,6,K$3:K$256/(J$3:J$256=J3),1)
    If this doesn't help then please explain why as well as providing some manually calculated results with which we may compare our proposed solutions.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: VBA - to find the highest letter, mix with letters and numbers.

    Quote Originally Posted by TAllan View Post
    When sales staff enter Quote in the system (SAP) we get an number example 1008307-A, if we do a change or an update to the same quote we get 1008307-B, same numbers but -B instead of A, every time they update the quote we get a new letter and when I try to run a report, I get them all in Excel but I would only like to see the "highest" Letter of the Quote.
    VBA
    Please Login or Register  to view this content.

  6. #6
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: VBA - to find the highest letter, mix with letters and numbers.

    Please try

    Please Login or Register  to view this content.
    I change font color to white
    r.Font.ColorIndex = 2
    you may change it as need.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    02-23-2021
    Location
    Edmonton, Canada
    MS-Off Ver
    Excel 2016
    Posts
    30

    Re: VBA - to find the highest letter, mix with letters and numbers.

    Thanks for all the help. It works perfect.
    Now I will try to figure out how to delete the ones I don't want to see.

+ 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] Can I find the lowest letter in a range of letters
    By EddieLFC in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 02-19-2020, 05:41 PM
  2. MAX Function to obtain highest value of numbers with a letter prefix
    By HipAcct in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-30-2018, 12:17 PM
  3. [SOLVED] Find in each letter of the corresponding 8 letters in each group
    By jorel in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-07-2018, 03:24 PM
  4. Incrementing Letter / Numbers / Letters in a single cell
    By Alan27 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-30-2017, 06:11 PM
  5. [SOLVED] Highest Value in Row, Including Letters and Numbers
    By BettyC in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 02-10-2016, 12:06 PM
  6. Replies: 8
    Last Post: 05-20-2015, 10:25 AM
  7. Get the highest value when all values consist of letters AND numbers
    By LinaVa in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 02-18-2014, 10:48 AM

Tags for this Thread

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