+ Reply to Thread
Results 1 to 30 of 30

return min and max values when there is #N/A in the range

  1. #1
    Forum Contributor
    Join Date
    06-18-2017
    Location
    Lithuania
    MS-Off Ver
    2016
    Posts
    177

    return min and max values when there is #N/A in the range

    I have range of values and need to return min and max values of that range, however, some of the values in the range are #N/A and when I use =min or =max formula I always get #N/A as a result.

    How to make excel exclude those #N/A values and pick min and max from those cells, which contain actual numbers only? so, let's say =min formula in G2 would only take values from B2 and C2?

    I attached a photo, which may help to describe my issue.

    Thanks!
    Attached Images Attached Images
    Last edited by kao; 02-28-2018 at 11:56 PM.

  2. #2
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,899

    Re: return min and max values when there is #N/A in the range

    Max value:

    =AGGREGATE(14,6,range,1)

    Min:

    =AGGREGATE(15,6,range,1)

  3. #3
    Forum Contributor
    Join Date
    06-18-2017
    Location
    Lithuania
    MS-Off Ver
    2016
    Posts
    177

    Re: return min and max values when there is #N/A in the range

    why not 4 and 5 instead of 15 and 16?

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

    Re: return min and max values when there is #N/A in the range

    No reason:

    =AGGREGATE(5,6,$A$1:$A$9)

    works just as well (note: no ,1 at the end.
    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.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  5. #5
    Forum Contributor
    Join Date
    06-18-2017
    Location
    Lithuania
    MS-Off Ver
    2016
    Posts
    177

    Re: return min and max values when there is #N/A in the range

    And how to make the cell from which formula aggregate takes the value from highlight itself? So I would be instantly able to see from which range it has been taken?

    Cheers!

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: return min and max values when there is #N/A in the range

    That would need Conditional Formatting.

    Highlight A2:F2, and go to conditional formatting.
    Use the formula
    =A2=$G2
    Last edited by Jonmo1; 03-01-2018 at 10:00 AM.

  7. #7
    Forum Contributor
    Join Date
    06-18-2017
    Location
    Lithuania
    MS-Off Ver
    2016
    Posts
    177

    Re: return min and max values when there is #N/A in the range

    Quote Originally Posted by Glenn Kennedy View Post
    No reason:

    =AGGREGATE(5,6,$A$1:$A$9)

    works just as well (note: no ,1 at the end.
    What does $ besides the range do?

  8. #8
    Forum Contributor
    Join Date
    06-18-2017
    Location
    Lithuania
    MS-Off Ver
    2016
    Posts
    177

    Re: return min and max values when there is #N/A in the range

    Quote Originally Posted by Jonmo1 View Post
    That would need Conditional Formatting.

    Highlight A2:F2, and go to conditional formatting.
    Use the formula
    =A2=$G2
    If I have 250 rows, how would be the easiest way to apply this to all of them?

  9. #9
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: return min and max values when there is #N/A in the range

    Instead of highlighting A2:F2, highlight A2:F251

  10. #10
    Forum Contributor
    Join Date
    06-18-2017
    Location
    Lithuania
    MS-Off Ver
    2016
    Posts
    177

    Re: return min and max values when there is #N/A in the range

    but then here I can only choose once cell (one value), but not a range of cells
    Attached Images Attached Images

  11. #11
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: return min and max values when there is #N/A in the range

    In the first step of the CF wizard, choose the option that says “Use a formula to determine...”

  12. #12
    Forum Contributor
    Join Date
    06-18-2017
    Location
    Lithuania
    MS-Off Ver
    2016
    Posts
    177

    Re: return min and max values when there is #N/A in the range

    and then? what should I put in "format values where this formula is true:" ?

  13. #13
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: return min and max values when there is #N/A in the range

    Quote Originally Posted by kao View Post
    what should I put in "format values where this formula is true:" ?
    See post # 6

  14. #14
    Forum Contributor
    Join Date
    06-18-2017
    Location
    Lithuania
    MS-Off Ver
    2016
    Posts
    177

    Re: return min and max values when there is #N/A in the range

    sorry, I still do not get it.

    Could you please perform it in the excel file I uploaded?
    Thanks!
    Attached Files Attached Files

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,288

    Re: return min and max values when there is #N/A in the range

    You need to learn how to do it yourself. Get rid of any attempts you have made so far, then follow these steps in your own file exactly:

    1. Select cell A1.
    2. Open the CF dialog - create a new rule using the bottom option (formula).
    3. In the formula box, type this: =A1=$H1
    4. Choose your formatting.
    5. Click OK.
    6. In the Applies To ... box, type this: =$A$1:$F$34
    7. Click OK.

    Example attached.
    Attached Files Attached Files
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  16. #16
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,288

    Re: return min and max values when there is #N/A in the range

    You can create two rules to do what I think you want.

    For each rule, change the formula at step 3 above with:

    =A1=MINIFS($A1:$F1,$A1:$F1,"<>#N/A")

    or:

    =A1=MAXIFS($A1:$F1,$A1:$F1,"<>#N/A")

    May not work if you don't have the subscription version, however.
    Attached Files Attached Files
    Last edited by AliGW; 03-04-2018 at 06:20 AM.

  17. #17
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,288

    Re: return min and max values when there is #N/A in the range

    If you don't have any luck with MINIFS and MAXIFS, use these instead:

    =A1=MIN(IF(ISNA($A1:$F1),"",$A1:$F1))

    and:

    =A1=MAX(IF(ISNA($A1:$F1),"",$A1:$F1))
    Attached Files Attached Files
    Last edited by AliGW; 03-04-2018 at 06:38 AM.

  18. #18
    Forum Contributor
    Join Date
    06-18-2017
    Location
    Lithuania
    MS-Off Ver
    2016
    Posts
    177

    Re: return min and max values when there is #N/A in the range

    AliG, does not work.
    The first method kinda works, but it highlights random values (not min and max)

  19. #19
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,288

    Re: return min and max values when there is #N/A in the range

    It works here. Did you look at the attachments?

    Excel 2016 (Windows) 32 bit
    A
    B
    C
    D
    E
    F
    1
    0.00000112
    0.00000111
    #N/A
    #N/A
    #N/A
    #N/A
    2
    0.00003595
    0.00003475
    #N/A
    #N/A
    #N/A
    #N/A
    3
    0.00036832
    0.00037192
    #N/A
    0.0003677
    0.0003656
    #N/A
    4
    0.00019364
    0.00019142
    #N/A
    #N/A
    #N/A
    #N/A
    5
    0.00000001
    0.00003334
    0.00003346
    0.00003321
    #N/A
    #N/A
    6
    0.00000686
    0.00000694
    #N/A
    #N/A
    #N/A
    #N/A
    7
    0.11221936
    #N/A
    0.11069
    #N/A
    0.1107751
    0.11072000
    8
    0.00010349
    0.00010307
    #N/A
    0.00010246
    #N/A
    #N/A
    9
    0.00003826
    0.00003815
    #N/A
    #N/A
    #N/A
    #N/A
    10
    0.00000012
    #N/A
    #N/A
    0.000046
    #N/A
    #N/A
    11
    0.000095
    0.00009549
    #N/A
    #N/A
    #N/A
    #N/A
    12
    11227.2
    11202.5172
    #N/A
    11209
    #N/A
    #N/A
    13
    0.00097494
    0.00955099
    0.0095203
    0.009531
    0.00959731
    #N/A
    14
    0.00003581
    #N/A
    #N/A
    #N/A
    0.0000352
    #N/A
    15
    0.00005758
    #N/A
    #N/A
    #N/A
    0.00000295
    #N/A
    16
    0.00000646
    0.00000656
    #N/A
    #N/A
    #N/A
    #N/A
    17
    0.00055073
    0.00052469
    #N/A
    #N/A
    #N/A
    #N/A
    18
    0.00119573
    0.00112998
    #N/A
    #N/A
    #N/A
    #N/A
    19
    0.0000171
    #N/A
    #N/A
    0.00001175
    0.00001182
    #N/A
    20
    0.0000655
    #N/A
    #N/A
    0.00006014
    0.00006055
    #N/A
    21
    0.0536841
    0.0533484
    #N/A
    0.053477
    0.05360999
    0.05357000
    22
    599.7690696
    606.075
    #N/A
    #N/A
    #N/A
    #N/A
    23
    0.0072
    0.00709124
    #N/A
    #N/A
    #N/A
    #N/A
    24
    0.00000312
    0.00000309
    #N/A
    #N/A
    0.00000312
    #N/A
    25
    0.0000356
    #N/A
    #N/A
    #N/A
    0.00003653
    #N/A
    26
    0.00000047
    0.00000047
    #N/A
    #N/A
    #N/A
    0.000000480
    27
    0.00000677
    0.00000669
    #N/A
    #N/A
    #N/A
    #N/A
    28
    0.00002499
    0.00002353
    #N/A
    #N/A
    #N/A
    #N/A
    29
    0.00003349
    0.0000329
    #N/A
    #N/A
    #N/A
    #N/A
    30
    0.00033707
    0.00033004
    #N/A
    #N/A
    #N/A
    #N/A
    31
    0.00002654
    0.00002628
    #N/A
    #N/A
    #N/A
    #N/A
    32
    0.0000157
    #N/A
    #N/A
    0.00001601
    #N/A
    #N/A
    33
    0.00272999
    0.00270989
    0.0027079
    0.002716
    0.00271176
    0.00271900
    34
    30.9549998
    30.28399999
    #N/A
    #N/A
    #N/A
    #N/A
    Sheet: Sheet1
    Last edited by AliGW; 03-04-2018 at 09:25 AM.

  20. #20
    Forum Contributor
    Join Date
    06-18-2017
    Location
    Lithuania
    MS-Off Ver
    2016
    Posts
    177

    Re: return min and max values when there is #N/A in the range

    alright, so I have tried it myself by copying some of the values to other sheet and pasting them as values and it actually works!

    so the reason why it does not work for me is because the values in my cells are not actually values, but they are rather references (formulas), to be specific, VLOOKUPs from other sheets.
    So how to adjust it so it would work in my case?

  21. #21
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,288

    Re: return min and max values when there is #N/A in the range

    It should make no difference if the results of the formulae are numbers, but it sounds like they may be text, in which case you would need to tweak the formulae that produce them. Attach a workbook with a sample and one of us will advise.

  22. #22
    Forum Contributor
    Join Date
    06-18-2017
    Location
    Lithuania
    MS-Off Ver
    2016
    Posts
    177

    Re: return min and max values when there is #N/A in the range

    Here it is, thanks!
    Attached Files Attached Files

  23. #23
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: return min and max values when there is #N/A in the range

    You can put +0 at the end of y our vlookups to convert 'Text Numbers' to Real numbers.

    =vlookup(....)+0

  24. #24
    Forum Contributor
    Join Date
    06-18-2017
    Location
    Lithuania
    MS-Off Ver
    2016
    Posts
    177

    Re: return min and max values when there is #N/A in the range

    Jonmo, does not help in this case.

  25. #25
    Forum Contributor
    Join Date
    06-18-2017
    Location
    Lithuania
    MS-Off Ver
    2016
    Posts
    177

    Re: return min and max values when there is #N/A in the range

    Also, the min/max values are extracted in other columns.

    So min values are extracted to column H in this case.

    so maybe we can use some other formula so it would take the value from column H, and then look in B:F and highlight the cell which is equal to the one in column H?

  26. #26
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,288

    Re: return min and max values when there is #N/A in the range

    We have already done it with a helper column - look back at post #15. But you don't need a helper column.

    It's not working because your formula in the CF rule is not correct. The range in your original sample file started at A1. In the new file, it starts at B2, so instead of this:

    =A1=MIN(IF(ISNA($A1:$F1),"",$A1:$F1))

    you need this:

    =B2=MIN(IF(ISNA($B2:$F2),"",$B2:$F2))

    I've fixed it for you in the attached.

    Excel 2016 (Windows) 32 bit
    A
    B
    C
    D
    E
    F
    G
    H
    1
    2
    ABYBTC
    0.00000114
    #N/A
    #N/A
    0.00000112
    #N/A
    0.00000112
    3
    AMPBTC
    0.00003614
    #N/A
    #N/A
    0.00003626
    #N/A
    0.00003614
    4
    ARKBTC
    0.00036848
    #N/A
    #N/A
    0.00037346
    0.00037069
    0.00036848
    5
    AURBTC
    0.00019
    #N/A
    #N/A
    0.00019059
    #N/A
    0.00019
    6
    BATBTC
    0.00000001
    #N/A
    3.29E-05
    0.00003277
    #N/A
    0.00000001
    7
    BAYBTC
    0.00000725
    #N/A
    #N/A
    0.00000735
    #N/A
    0.00000725
    8
    BCHBTC
    0.11223078
    0.11179000
    0.11176
    #N/A
    0.11153215
    0.11153215
    9
    BCPTBTC
    0.00009753
    #N/A
    #N/A
    0.00009563
    #N/A
    0.00009563
    10
    BLKBTC
    0.00003828
    #N/A
    #N/A
    0.00003784
    #N/A
    0.00003784
    11
    BLZBTC
    0.00000013
    #N/A
    #N/A
    #N/A
    #N/A
    0.00000013
    12
    BSDBTC
    0.0000984
    #N/A
    #N/A
    0.00009848
    #N/A
    0.0000984
    13
    BTCUSDT
    11464.99
    #N/A
    #N/A
    11457.98999
    #N/A
    11457.99
    14
    BTGBTC
    0.00097105
    #N/A
    0.009501
    0.00951042
    0.00958873
    0.00097105
    15
    BTMBTC
    0.00003519
    #N/A
    #N/A
    #N/A
    0.00003687
    0.00003519
    16
    CANBTC
    0.0000574
    #N/A
    #N/A
    #N/A
    0.00000269
    0.00000269
    17
    CANNBTC
    0.00000627
    #N/A
    #N/A
    0.00000627
    #N/A
    0.00000627
    18
    CLAMBTC
    0.0005393
    #N/A
    #N/A
    0.00053023
    #N/A
    0.00053023
    19
    CLOAKBTC
    0.00144627
    #N/A
    #N/A
    0.00137202
    #N/A
    0.00137202
    20
    CMTBTC
    0.00001683
    #N/A
    #N/A
    #N/A
    0.00001204
    0.00001204
    21
    CTRBTC
    0.0000694
    #N/A
    #N/A
    #N/A
    0.00006059
    0.00006059
    22
    DASHBTC
    0.05399998
    0.05411000
    #N/A
    0.05390908
    0.05443927
    0.05390908
    23
    DASHUSDT
    616.733101
    #N/A
    #N/A
    620.0300798
    #N/A
    616.733101
    24
    DCRBTC
    0.00720481
    #N/A
    #N/A
    0.00702
    #N/A
    0.00702
    Sheet: dup
    Attached Files Attached Files
    Last edited by AliGW; 03-05-2018 at 02:15 AM.

  27. #27
    Forum Contributor
    Join Date
    06-18-2017
    Location
    Lithuania
    MS-Off Ver
    2016
    Posts
    177

    Re: return min and max values when there is #N/A in the range

    You are an angel, AliG, thanks!!!

  28. #28
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,288

    Re: return min and max values when there is #N/A in the range

    You're welcome - glad we got there in the end.
    Last edited by AliGW; 03-05-2018 at 05:59 PM.

  29. #29
    Forum Contributor
    Join Date
    06-18-2017
    Location
    Lithuania
    MS-Off Ver
    2016
    Posts
    177

    Re: return min and max values when there is #N/A in the range

    Quote Originally Posted by kao View Post
    I have range of values and need to return min and max values of that range, however, some of the values in the range are #N/A and when I use =min or =max formula I always get #N/A as a result.

    How to make excel exclude those #N/A values and pick min and max from those cells, which contain actual numbers only? so, let's say =min formula in G2 would only take values from B2 and C2?

    I attached a photo, which may help to describe my issue.

    Thanks!
    getting back to my original post.

    is there any way to exclude certain columns from the range?

    so it would be someting like this:

    =AGGREGATE(5,6,$A$1:$G$1(excluding columns B and F)

    what would be the formula for that?

  30. #30
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,288

    Re: return min and max values when there is #N/A in the range

    The original question was specifically about cells containing the error message. I suggest you start a new thread with an appropriate title, as this new request is actually quite different.

    When you start the new thread, provide a sample file that includes the data and formulae you are currently using, and manually add data to show what you want.

+ 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. Check range for values and return list of found unique values
    By kian82 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-13-2017, 04:45 AM
  2. [SOLVED] return FROM TO values from custom defined range , and return all possible combination
    By raj soni in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-29-2016, 01:38 PM
  3. Replies: 4
    Last Post: 10-01-2015, 11:01 AM
  4. Replies: 13
    Last Post: 10-13-2014, 02:00 AM
  5. [SOLVED] Return value if within range, return multiple values if ranges overlap
    By cde1983 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-17-2013, 06:16 AM
  6. Replies: 2
    Last Post: 11-12-2012, 06:26 AM
  7. search a cell for values in a range, return values found
    By carpe.cervisiam in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-15-2011, 12:52 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