+ Reply to Thread
Results 1 to 14 of 14

How to get the maximum value ignoring the text ?

  1. #1
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    How to get the maximum value ignoring the text ?

    I've searched on the internet, but I couldn't find the vba MAX with a case
    where the values to be found as max value is something like this "PA-190909xxx".
    The "190909" is based on a formatted current date "yymmdd"

    Sometimes the user need to know what is the last invoice number of current date.

    For example, in the "DATA" worksheet the invoice numbers are :
    PA-190909134
    PA-190909142
    PA-190909143
    PA-190909171
    PA-190909120

    So he wants the code to show him a message box,
    something like "The last invoice number of today is PA-190909171"
    rather than he select the sheets DATA, then search the rows to find the latest invoice number.

    What I've tried :
    Please Login or Register  to view this content.
    Which of course it doesn't work.

    So how is the code to get that kind of message box ?

    Any kind of respond would be greatly appreciated.
    Thank you in advanced.

  2. #2
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: How to get the maximum value ignoring the text ?

    try
    Please Login or Register  to view this content.

  3. #3
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: How to get the maximum value ignoring the text ?

    apologies
    Please Login or Register  to view this content.
    Last edited by nigelog; 09-09-2019 at 07:21 AM.

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: How to get the maximum value ignoring the text ?

    something like this "PA-190909xxx".
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  5. #5
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    861

    Re: How to get the maximum value ignoring the text ?

    Hi there karmapala,

    If you care to use a non-VBA solution, use this array formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    This is an array formula so enter it using CTRL+SHIFT+ENTER.
    .. and don't forget to have fun!
    Bogdan.

    mark SOLVED and Add Reputation if my answer pleases you

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: How to get the maximum value ignoring the text ?

    Maybe
    Please Login or Register  to view this content.
    although this won't work if you have blank cells in the range

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

    Re: How to get the maximum value ignoring the text ?

    Please Login or Register  to view this content.

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: How to get the maximum value ignoring the text ?

    jindon's code just rocks...

    Please Login or Register  to view this content.

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

    Re: How to get the maximum value ignoring the text ?

    Quote Originally Posted by karmapala View Post
    So he wants the code to show him a message box,
    something like "The last invoice number of today is PA-190909171"
    Please Login or Register  to view this content.

  10. #10
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: How to get the maximum value ignoring the text ?

    Just noticed invoice number is for the current date, no idea if resets to 1 for the next day but taking that into account
    Please Login or Register  to view this content.

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

    Re: How to get the maximum value ignoring the text ?

    Hummm, for the month...
    Please Login or Register  to view this content.

  12. #12
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: How to get the maximum value ignoring the text ?

    Wow... thank you for the codes, nigelog, sintek (and the attachment file), bulina, fluff13 and jindon.
    The code from all of you work well.

    However I have to choose...
    so I choose jindon's code.

    Please Login or Register  to view this content.
    Thank you once again guys.
    I really appreciate it.

  13. #13
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: How to get the maximum value ignoring the text ?

    You're welcome & thanks for the feedback

  14. #14
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: How to get the maximum value ignoring the text ?

    Quote Originally Posted by jindon View Post
    Please Login or Register  to view this content.
    Interesting and surprising to me... the single sheet reference before the short-form Evaluate function call propagates to the two ranges inside. Is doing it this way better than the way I always thought it had to be done?

    MsgBox [max(if(left(data!c1:c10000,3)="PA-",substitute(data!c1:c10000,"PA-","")+0))]
    Last edited by Rick Rothstein; 09-09-2019 at 04:32 PM.

+ 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] extract Maximum Length text from a Text String
    By shukla.ankur281190 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-26-2018, 06:55 AM
  2. [SOLVED] return text ignoring text in parentheses
    By Mike Brewer in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-24-2016, 10:00 AM
  3. how to sum numbers formated as a text ignoring text in cells
    By luis6777 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-30-2014, 01:45 PM
  4. [SOLVED] sorting by maximum value and displaying a corresponding text with the maximum value
    By ScottBeatty in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 06-20-2013, 03:11 PM
  5. Maximum and Text
    By windme in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-24-2010, 02:18 PM
  6. Ignoring Text when calculating
    By marlen0804 in forum Excel General
    Replies: 6
    Last Post: 09-24-2006, 11:12 AM
  7. Replies: 1
    Last Post: 09-18-2005, 05:05 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