+ Reply to Thread
Results 1 to 31 of 31

MIN-MAX trouble

Hybrid View

JoKnows MIN-MAX trouble 03-23-2013, 07:51 PM
FDibbins Re: MIN-MAX trouble 03-23-2013, 07:55 PM
Tony Valko Re: MIN-MAX trouble 03-23-2013, 07:57 PM
JoKnows Re: MIN-MAX trouble 03-23-2013, 08:14 PM
FDibbins Re: MIN-MAX trouble 03-23-2013, 08:18 PM
JoKnows Re: MIN-MAX trouble 03-23-2013, 08:20 PM
FDibbins Re: MIN-MAX trouble 03-23-2013, 08:23 PM
JoKnows Re: MIN-MAX trouble 03-23-2013, 08:31 PM
JoKnows Re: MIN-MAX trouble 03-23-2013, 08:28 PM
FDibbins Re: MIN-MAX trouble 03-23-2013, 08:43 PM
JoKnows Re: MIN-MAX trouble 03-23-2013, 09:00 PM
JoKnows Re: MIN-MAX trouble 03-23-2013, 10:51 PM
FDibbins Re: MIN-MAX trouble 03-24-2013, 01:03 AM
FDibbins Re: MIN-MAX trouble 03-23-2013, 11:43 PM
JoKnows Re: MIN-MAX trouble 03-24-2013, 12:31 AM
FDibbins Re: MIN-MAX trouble 03-24-2013, 12:36 AM
JoKnows Re: MIN-MAX trouble 03-24-2013, 12:51 AM
JoKnows Re: MIN-MAX trouble 03-24-2013, 01:37 AM
Tony Valko Re: MIN-MAX trouble 03-24-2013, 09:26 AM
JoKnows Re: MIN-MAX trouble 03-24-2013, 11:50 AM
bebo021999 Re: MIN-MAX trouble 03-24-2013, 12:23 PM
JoKnows Re: MIN-MAX trouble 03-24-2013, 03:08 PM
Tony Valko Re: MIN-MAX trouble 03-24-2013, 03:44 PM
JoKnows Re: MIN-MAX trouble 03-24-2013, 05:08 PM
Tony Valko Re: MIN-MAX trouble 03-25-2013, 02:34 PM
JoKnows Re: MIN-MAX trouble 03-25-2013, 07:05 PM
Tony Valko Re: MIN-MAX trouble 03-25-2013, 09:45 PM
JoKnows Re: MIN-MAX trouble 03-25-2013, 10:08 PM
Tony Valko Re: MIN-MAX trouble 03-26-2013, 09:49 AM
JoKnows Re: MIN-MAX trouble 03-26-2013, 10:58 PM
Tony Valko Re: MIN-MAX trouble 03-26-2013, 11:05 PM
  1. #1
    Registered User
    Join Date
    01-09-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    16

    MIN-MAX trouble

    Greetings,

    I'm trying to create a MIN-MAX formula that will retrieve the MIN and MAX values in a range. The trouble I'm having is, the range contains two types of values. Some contain a $, others contain a %. Essentially, I would like to return the MIN and MAX for both types of values so that if my range looked something like

    1$
    2$
    5%
    7%
    8$
    10%

    The formula would return something like: 1$-8$, 5%-10%

    Any assistance would be greatly appreciated!

  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
    53,048

    Re: MIN-MAX trouble

    Hi and welcome to the forum

    Why on earth would you have a mix of info like that??

    I would suggest that you create 2 helper columns and extract each type of data seperately - then you can min and max to your heart's content
    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 Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: MIN-MAX trouble

    Are these entries actual number values or are they TEXT entries?

    If you select a cell that displays as 1$, what do you see in the formula bar?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    01-09-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: MIN-MAX trouble

    The range has been extracted from a series of rows, so the formula bar simply has the INDEX formula I was using (ribbon shows General formatting) - the format doesn't matter to me as long as it displays "1%" or "1$"

    The problem with creating two helper columns is that I need to keep the ordering in order return the MIN-MAX values for specific cells. Basically I have something like

    Doctors Office 35$
    Specialist Office 40$
    Chiro visit 40%
    Allergy Shots 15%

    I have a template that needs to draw the MIN-MAX for those cells and it needs to return as "35$-40$, 15%-40%"

    Furthermore, different cells in my template will be looking at different costs - such as A1 needs to look at Doctors Office, Specialist Office, and Allergy Shots. This should return "35$-40$, 15%-15%. A2 needs to look at just Specialist Office, and would return 40$, and so on, with different combinations.

    Thank you all for your quick response!

  5. #5
    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
    53,048

    Re: MIN-MAX trouble

    OK, so is there some rule that can be applied that would identify certain "categories" as being % and others as being %....and would the % ever be greater than 1 (100%) and the $ ever be less than 1. eg 120% and $0.50

  6. #6
    Registered User
    Join Date
    01-09-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: MIN-MAX trouble

    The % will not be greater than 100%, and the $ will not be less than 0.

    Thanks

  7. #7
    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
    53,048

    Re: MIN-MAX trouble

    ok, and the 1st part of my question?

  8. #8
    Registered User
    Join Date
    01-09-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: MIN-MAX trouble

    ALso, if there is a solution in VBA, that would be even better.

    Many thanks!

  9. #9
    Registered User
    Join Date
    01-09-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: MIN-MAX trouble

    There is nothing determining whether the specific categories will be a % or a $ - if by rule you mean something like "Doctors Office" will always be $. This will be subject to change, as I pull in different tables, the "Doctors Office" category may be $, or %.

    Apologies if I misunderstood your question.
    Last edited by JoKnows; 03-23-2013 at 08:32 PM.

  10. #10
    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
    53,048

    Re: MIN-MAX trouble

    adding he;per columns shouldnt alter the the order (sequence?) of your data?
    The problem with creating two helper columns is that I need to keep the ordering in order return the MIN-MAX values for specific cells.
    Im thinking of something like
    in B1 =IF(A1>1,A1,"")
    in C1 =IF(A1<1,A1,"")
    then you could use...
    ="$"&MIN(B1:B6)&"-$"&MAX(B1:B6)
    and
    =TEXT(MIN(C1:C6)*100,"0.0")&"%-"&TEXT(MAX(C1:C6)*100,"0.0")&"%"

  11. #11
    Registered User
    Join Date
    01-09-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: MIN-MAX trouble

    I believe this will work. Thanks so much, I really appreciate it!

  12. #12
    Registered User
    Join Date
    01-09-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: MIN-MAX trouble

    One followup question.

    Min and Max functions will return a "0" if the range is blank. Is there any way to NOT return the 0 if the range is blank? Currently, if I have something like this

    Doctors Office 40%

    The formula will return: $0-$0,40%-40%

    I need it to return 40%-40%


    Thanks

  13. #13
    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
    53,048

    Re: MIN-MAX trouble

    OK that wasnt what you asked for in post 12...

    Quote Originally Posted by JoKnows View Post
    One followup question.

    Min and Max functions will return a "0" if the range is blank. Is there any way to NOT return the 0 if the range is blank? Currently, if I have something like this

    Doctors Office 40%

    The formula will return: $0-$0,40%-40%

    I need it to return 40%-40%

    Thanks
    =if(sum(the-range-you-used-for-%)=0,"0%-0%",your-min/max-formula)&if(sum(the-range-you-used-for-$)=0,"$0-$0",","&your-min/max-formula)

  14. #14
    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
    53,048

    Re: MIN-MAX trouble

    without seeing your formula, try something like this....

    =if(sum(the-range-you-used-for-%)=0,"",your-min/max-formula)&if(sum(the-range-you-used-for-$)=0,"",","&your-min/max-formula)

  15. #15
    Registered User
    Join Date
    01-09-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: MIN-MAX trouble

    That would work, but if the range contained values of 0$ or 0%, they would not be calculated in the Min-Max result. I need 0$ and 0% to be calculated, but blanks ignored.

  16. #16
    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
    53,048

    Re: MIN-MAX trouble

    if the sum of the range is 0, then you wont have a min or a max, thats why I used that approach? If the range contained other values besides 0, then the sum of that range would not be 0, and the min/max would then be calculated

  17. #17
    Registered User
    Join Date
    01-09-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: MIN-MAX trouble

    I understand. The issue I'm having is that I need the result to be the Min-Max for $ AND the Min-Max for %. In some cases I may have 0$ for all values in the $ column, and values greater than 0 in the % column. So, the result should be 0$-0$, x%-y%. If I read your formula correctly, the result would be simply x%-y%, excluding the 0$-0$, which wouldn't work for me. If there is a 0$ or 0% in either column (even if it is the only value in that column), I need it to be calculated in the Min-Max result. That being said, if the entire range for either $ or % is blank, I need the result to be blank.

    Apologies if I was unclear. Again, I'm very thankful for your help!

  18. #18
    Registered User
    Join Date
    01-09-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: MIN-MAX trouble

    I'll try to explain once again.

    The formula works fine for Case 1.
    Case 1
    A B
    0$ 50%
    0$ 60%

    Result I need: 0$-0$,50%-60%


    The issue is Case 2.
    Case 2
    A B
    blank 50%
    blank 60%

    Result I need: 50%-60%

    As I said in post 12, if the column is blank, Min and Max read the blank as a "0" and delivers a "0$-0$,50%-60%, which is inaccurate.

    I hope that clarifies the issue.
    Last edited by JoKnows; 03-24-2013 at 01:43 AM.

  19. #19
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: MIN-MAX trouble

    Can you post a SMALL sample file (~20 rows worth of data) so we can see what you're trying to do?

    Make sure you include the results you expect.

  20. #20
    Registered User
    Join Date
    01-09-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: MIN-MAX trouble

    Tony,

    See the small file I attached that represents the problem in post 18. As I mentioned, Case 1 is fine. Case 2 needs to show only 50%-50%.

    Thanks for your help.

    Workbook2.xlsx

  21. #21
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,651

    Re: MIN-MAX trouble

    May be:
    =IF(COUNTIF(B3:B6,"")=0,"$"&MIN(B3:B6)&"-$"&MAX(B3:B6)&",","")&TEXT(MIN(C3:C6)*100,"0.0")&"%-"&TEXT(MAX(C3:C6)*100,"0.0")&"%"
    Quang PT

  22. #22
    Registered User
    Join Date
    01-09-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: MIN-MAX trouble

    That should work, thanks a bunch!

  23. #23
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: MIN-MAX trouble

    Quote Originally Posted by JoKnows View Post
    That should work, thanks a bunch!
    Are you sure that works?

    In your sample file the data in B3:B6 is TEXT. Try changing one of the cell entries to 15 (or any number other than 0) and see what result you get.

    Do you absolutely have to have those dollar signs on the right side of the cell entry? That's what is making the cell data type TEXT.

  24. #24
    Registered User
    Join Date
    01-09-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: MIN-MAX trouble

    You're right Tony. Thanks for pointing that out. Any suggestions?

  25. #25
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: MIN-MAX trouble

    Will there ever be a case 3?

    Case 1 = 0$ ... 50%

    Case 2 = [blank] ... 50%

    Case 3 = 0$ ... [blank]

    If there can be a case 3 then what result would you expect?

  26. #26
    Registered User
    Join Date
    01-09-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: MIN-MAX trouble

    Tony,

    Yes, that is a possibility, as is Case 4 = 0$... 0%

    Thanks

  27. #27
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: MIN-MAX trouble

    Ok, let's see if I understand this...

    The $ values and the % values will always be in separate columns?

    There may or may not be $ values and/or % values in either column?

    There can be 4 possible results:

    min$ - max$ , min% - max%

    min$ - max$

    min% - max%

    [blank] when there are neither $ values nor % values

    Does that cover everything?

  28. #28
    Registered User
    Join Date
    01-09-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: MIN-MAX trouble

    Yes, thats correct.

  29. #29
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: MIN-MAX trouble

    OK, this seems to work...

    B3:B6 = Copay
    C3:C6 = Coinsurance

    This array formula** entered in E3:

    =TRIM(IF(COUNTA(B3:B6),MIN(IF(B3:B6<>"",--SUBSTITUTE(B3:B6,"$","")))&"$-"&MAX(IF(B3:B6<>"",--SUBSTITUTE(B3:B6,"$","")))&"$","")&IF(COUNTA(C3:C6)," "&TEXT(MIN(C3:C6),"0%")&"-"&TEXT(MAX(C3:C6),"0%"),""))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

  30. #30
    Registered User
    Join Date
    01-09-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: MIN-MAX trouble

    That's perfect. Thanks!

  31. #31
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: MIN-MAX trouble

    You're welcome. Thanks for the feedback!

+ 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