Trying to use is number function in excel to find min and max value of data

MikeyP14

New Member
Joined
Jan 27, 2021
Messages
7
Office Version
  1. 2016
Platform
  1. Windows
Hi All,

I am new to the site but I am trying to find a min and a max value in excel and have a formula that seems to work 90% of the time but if a text string has the number I am trying to filter by in it then it could potentially return the wrong value. See my example table below.

CharacterMaxmin
66​
77​
5​
Datasetvalue
66 aaa
35​
66 aaa
39​
366 aaa
75​
366 aaa
77​
566 aaa
5​
566 aaa
10​

I am able to search the data above using the following criteria
Max (Returns 77 not 39) - =MAX(IF(ISNUMBER(SEARCH(A2,$A3:$A100)),$B3:$B100, ""))
Min (Returns 5 not 35)- =MIN(IF(ISNUMBER(SEARCH(A2,$A3:$A100)),$B3:$B100, ""))


Any guidance you can provide would be greatly appreciated.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
You can't use a matrix in: SEARCH(A2,$A3:$A100)
You can use a matrix-formula:
Map3
E
339
Blad1
Cell Formulas
RangeFormula
E3E3=MAX(((SEARCH(A2,A3:A5,1)=1)*(B3:B5)))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Hi,

This is one way:

Book3.xlsx
ABCD
2663935
3Datasetvalue
466 aaa35
566 aaa39
6366 aaa75
7366 aaa77
8566 aaa5
9566 aaa10
Sheet721
Cell Formulas
RangeFormula
C2C2=MAX(IF(ISNUMBER(1/(LEFT($A3:$A100,FIND(" ",$A3:$A100))+0=A2)),$B3:$B100,""))
D2D2=MIN(IF(ISNUMBER(1/(LEFT($A3:$A100,FIND(" ",$A3:$A100))+0=A2)),$B3:$B100,""))
Press CTRL+SHIFT+ENTER to enter array formulas.


Note that my formula will Not fail for A2 values that may be Partial value of A3:A100, (e.g. 6, 3, 36, 5, 56, etc.)

Book3.xlsx
ABCD
23600
3Datasetvalue
466 aaa35
566 aaa39
6366 aaa75
7366 aaa77
8566 aaa5
9566 aaa10
Sheet721
Cell Formulas
RangeFormula
C2C2=MAX(IF(ISNUMBER(1/(LEFT($A3:$A100,FIND(" ",$A3:$A100))+0=A2)),$B3:$B100,""))
D2D2=MIN(IF(ISNUMBER(1/(LEFT($A3:$A100,FIND(" ",$A3:$A100))+0=A2)),$B3:$B100,""))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Aggregate.xlsm
ABCD
1366 aaa77
2Datasetvalue
366 aaa35
466 aaa39
5366 aaa75
6366 aaa77
7566 aaa5
8566 aaa10
2d
Cell Formulas
RangeFormula
D1D1=AGGREGATE(14,6,$B$3:$B$8/(A3:A8=A1),1)
 
Upvote 0
for Max or Min by category

Aggregate.xlsm
ABCDEFGH
1366 aaa3Max7777Min7575
2Datasetvalue
366 aaa35
466 aaa39
5366 aaa75
6366 aaa77
7566 aaa5
8566 aaa10
2d
Cell Formulas
RangeFormula
D1D1=AGGREGATE(14,6,$B$3:$B$8/(A3:A8=A1),1)
E1E1=AGGREGATE(14,6,$B$3:$B$8/(--LEFT(A3:A8,1)=B1),1)
G1G1=AGGREGATE(15,6,$B$3:$B$8/(A3:A8=A1),1)
H1H1=AGGREGATE(15,6,$B$3:$B$8/(--LEFT(A3:A8,1)=B1),1)
 
Upvote 0
Formulas from post # 3, and added modified versions of your formulas in OP, all formulas will Not fail for partial matches:

Book3.xlsx
ABCDEF
26639353935
3Datasetvalue
466 aaa35
566 aaa39
6366 aaa75
7366 aaa77
8566 aaa5
9566 aaa10
Sheet721
Cell Formulas
RangeFormula
C2C2=MAX(IF(ISNUMBER(1/(LEFT($A3:$A100,FIND(" ",$A3:$A100))+0=A2)),$B3:$B100,""))
D2D2=MIN(IF(ISNUMBER(1/(LEFT($A3:$A100,FIND(" ",$A3:$A100))+0=A2)),$B3:$B100,""))
E2E2=MAX(IF(ISNUMBER(SEARCH(" "&A2&" "," "&$A3:$A100&" ")),$B3:$B100, ""))
F2F2=MIN(IF(ISNUMBER(SEARCH(" "&A2&" "," "&$A3:$A100&" ")),$B3:$B100, ""))
Press CTRL+SHIFT+ENTER to enter array formulas.


Book3.xlsx
ABCDEF
2360000
3Datasetvalue
466 aaa35
566 aaa39
6366 aaa75
7366 aaa77
8566 aaa5
9566 aaa10
Sheet721
Cell Formulas
RangeFormula
C2C2=MAX(IF(ISNUMBER(1/(LEFT($A3:$A100,FIND(" ",$A3:$A100))+0=A2)),$B3:$B100,""))
D2D2=MIN(IF(ISNUMBER(1/(LEFT($A3:$A100,FIND(" ",$A3:$A100))+0=A2)),$B3:$B100,""))
E2E2=MAX(IF(ISNUMBER(SEARCH(" "&A2&" "," "&$A3:$A100&" ")),$B3:$B100, ""))
F2F2=MIN(IF(ISNUMBER(SEARCH(" "&A2&" "," "&$A3:$A100&" ")),$B3:$B100, ""))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Hi All and thanks for the replies I am still getting an error when I am trying to use these new functions but now it is giving me a #value error or a #NUM! error. I do not think I gave enough detail in my first post. My search criteria is always just the base number but sometimes the data has -1 or -2 and is dynamic so it could go up to -20 and so on. My sheet that I am looking at an individual number on is also on a different sheet than the reference data.

It is like the data I have posted below

Sheet 1
CharacterMaxmin
66766

Max (Returning 76 and not 55) - =MAX(IF(ISNUMBER(SEARCH(A3,Sheet2!A:A)),Sheet2!B:B, ""))
Min (Returning 6 not 35) - =MIN(IF(ISNUMBER(SEARCH(A3,Sheet2!A:A)),Sheet2!B:B,""))

Sheet 2
Datasetvalue
66 aaa35
66 aaa39
66 aaa
40​
66 aaa
55​
366-1 aaa75
366-2 aaa77
366-3 aaa
76​
566-1 aaa5
566-2 aaa10
566-3 aaa
30​
566-4 aaa
22​
566-5 aaa
6​

Thanks again for all your help.
 
Upvote 0
How about
+Fluff 1.xlsm
ABCD
1CharacterMaxmin
2663935
3
Sheet1
Cell Formulas
RangeFormula
C2C2=AGGREGATE(14,6,Sheet2!B2:B13/(LEFT(Sheet2!A2:A13,LEN(A2))=A2&""),1)
D2D2=AGGREGATE(15,6,Sheet2!B2:B13/(LEFT(Sheet2!A2:A13,LEN(A2))=A2&""),1)


+Fluff 1.xlsm
ABC
1Datasetvalue
266 aaa35TRUE
366 aaa39TRUE
466 aaa40FALSE
566 aaa55FALSE
6366-1 aaa75TRUE
7366-2 aaa77TRUE
8366-3 aaa76FALSE
9566-1 aaa5TRUE
10566-2 aaa10TRUE
11566-3 aaa30FALSE
12566-4 aaa22FALSE
13566-5 aaa6FALSE
Sheet2
Cell Formulas
RangeFormula
C2:C13C2=ISNUMBER(B2)


Although it looks as though some of your numbers are actually text & not numbers.
 
Upvote 0
Solution
Thanks All for your help. Fluff that worked perfectly for my dataset thank you! One last question I have is I noticed you used 14 and 15 in the aggregate formula instead of 4 and 5. I went through and modified the code to try and use 4 and 5 simply because they are the max and min callouts but when I did the function broke and gave me an error again. When I changed it back to 14 and 15 being the largest and smallest it worked flawlessly. Is this because you can have additional criteria in the formulas when using 14 and 15?

Just curious as I am not a excel expert but trying to get smarter as I go.

Thanks again!
 
Upvote 0
You can only use arrays in the aggregate function when the 1st argument is 14 or greater.
 
Upvote 0

Forum statistics

Threads
1,214,946
Messages
6,122,401
Members
449,081
Latest member
JAMES KECULAH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top