MODE FORMULA FOR MULTIPLE CONDITIONS??

michellesssme

New Member
Joined
Aug 5, 2022
Messages
20
Office Version
  1. 2021
Platform
  1. Windows
Based on the Data column,
May I know the formula for both conditions (1. & 2.) by using MODE & IF Formula?
1. mode value for condition <650
2. mode value for condition >=650

3. May I know how to insert condition (<650) in the formula (=TEXT(MIN($N:$N),"0")&"~"&TEXT(MAX($N:$N),"0")?
4. How to write the formula to count how many data points fall on the specific range like from 600 to 700?

Data
666
702
741
678
673
707
737
729
797
731
799
729
710
655
608
628
658
643
646
666
628
636
641
677
626
646
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Have a look and let me know if this answers your questions. I am not quite clear on what is meant by #3, but I interpreted it to mean that you want the min and max of data satisfying the condition <650. The blue cells are user inputs...you may hardwire these values directly into the formulas if desired.
MrExcel_20220803.xlsx
NOPQR
1Data
2666Mode data <650628
3702Mode data >=650666
4741Min~Max608~799
5678Min~Max of data < 650608~646
6673
7707Lower endpoint of range600
8737Upper endpoint of range700
9729Count of points in range16
10797Count of points26
11731
12799
13729
14710
15655
16608
17628
18658
19643
20646
21666
22628
23636
24641
25677
26626
27646
Sheet9
Cell Formulas
RangeFormula
R2R2=MODE.SNGL(FILTER($N$2:$N$27,$N$2:$N$27<Q2))
R3R3=MODE.SNGL(FILTER($N$2:$N$27,$N$2:$N$27>=Q3))
R4R4=TEXT(MIN($N:$N),"0")&"~"&TEXT(MAX($N:$N),"0")
R5R5=TEXT(MIN(FILTER(N:N,N:N<650)),"0")&"~"&TEXT(MAX(FILTER(N:N,N:N<650)),"0")
R9R9=COUNTIFS(N:N,">="&Q7,N:N,"<="&Q8)
R10R10=COUNT(N:N)
 
Upvote 0
Solution
Hi, I approached it like this:

=MODE(FILTER(B:B,B:B>650)) (you can use <650 also for the other range.)

To find how many in each data array =COUNT(FILTER(B:B,B:B<650))

Is this what you need ?

Rob
 
Upvote 0
or there is this one, which looks for numbers > 2, and <3 (for example)

Excel Formula:
=LET( x,FILTER(B:B,B:B>2),y,FILTER(B:B,B:B<3),cntx,COUNT(x),cnty,COUNT(y),MODE(x) & "/" & cntx &" max "&MAX(x)&" min"&MIN(x)&"  - " &MODE(y)& "/" & cnty&" max:"&MAX(y)&" min:"&MIN(y))


it will output one cell like 4/10 max 5 min 3 - 2/10 max:2 min:1

so mode of the >2 was 4 with data points = 10 max was 5 min was 3 - mode of <3 was 2 / out of 10 numbers max:2 min:1

It might show you what you could do further.

Rgds
Rob
 
Upvote 0
Have a look and let me know if this answers your questions. I am not quite clear on what is meant by #3, but I interpreted it to mean that you want the min and max of data satisfying the condition <650. The blue cells are user inputs...you may hardwire these values directly into the formulas if desired.
MrExcel_20220803.xlsx
NOPQR
1Data
2666Mode data <650628
3702Mode data >=650666
4741Min~Max608~799
5678Min~Max of data < 650608~646
6673
7707Lower endpoint of range600
8737Upper endpoint of range700
9729Count of points in range16
10797Count of points26
11731
12799
13729
14710
15655
16608
17628
18658
19643
20646
21666
22628
23636
24641
25677
26626
27646
Sheet9
Cell Formulas
RangeFormula
R2R2=MODE.SNGL(FILTER($N$2:$N$27,$N$2:$N$27<Q2))
R3R3=MODE.SNGL(FILTER($N$2:$N$27,$N$2:$N$27>=Q3))
R4R4=TEXT(MIN($N:$N),"0")&"~"&TEXT(MAX($N:$N),"0")
R5R5=TEXT(MIN(FILTER(N:N,N:N<650)),"0")&"~"&TEXT(MAX(FILTER(N:N,N:N<650)),"0")
R9R9=COUNTIFS(N:N,">="&Q7,N:N,"<="&Q8)
R10R10=COUNT(N:N)
Hi, KRice. Thank you for the provided formula. I encountered an error for this formula. May I know what is the reason cause this happen?
 

Attachments

  • error2.PNG
    error2.PNG
    26.2 KB · Views: 5
Upvote 0
Hi again,

so if I imagine the user has typed "650~700" into Cell B3 - you can use below formula:

Cell C3 (data points calculation)
Excel Formula:
=LET(dash,FIND("~",B3,1),lowx,NUMBERVALUE(LEFT(B3,dash-1)),highx,NUMBERVALUE(MID(B3,dash+1,LEN(B3))),nbpnts,COUNT(FILTER(N:N,(N:N>=lowx) *( N:N<=highx))),nbpnts)

(this will dynamically pick up the data in B3 , whether two digits (23~45) or 5 digits (10000~20000)

Then to output the text in the way you wish in D3 (your yellow box), you can use :
Excel Formula:
=LET(dash,FIND("~",B3,1),lowx,NUMBERVALUE(LEFT(B3,dash-1)),highx,NUMBERVALUE(MID(B3,dash+1,LEN(B3))),ymax,MAX(FILTER(N:N,(N:N>=lowx) *( N:N<=highx))),ymin,MIN(FILTER(N:N,(N:N>=lowx) *( N:N<=highx))),ymin&"~"&ymax)

I have assumed that your data range of values remains in column "N"

Hope this works for you.
Rob
 
Upvote 0
In post #5, you mentioned…
I encountered an error for this formula. May I know what is the reason cause this happen?
The “This function isn’t valid“ message suggests that the FILTER function may not be available. Your profile shows two versions of Excel, with 2021 being the latest. Which version of Excel are you using when you see this error message?
 
Upvote 0
See the green cells and let me know if they answer your most recent question:
MrExcel_20220803.xlsx
NOPQRS
1Data
2666Mode data <650628
3702Mode data >=650666
4741Min~Max608~799
5678Min~Max of data < 650608~646608~646
6673min~max like (608~646)
7707Lower endpoint of range600
8737Upper endpoint of range700
9729Count of points in range16
10797Count of points26
11731
12799
13729
14710
15655
16608
17628
18658
19643
20646
21666
22628
23636
24641
25677
26626
27646
Sheet9
Cell Formulas
RangeFormula
R2R2=MODE.SNGL(FILTER($N$2:$N$27,$N$2:$N$27<Q2))
R3R3=MODE.SNGL(FILTER($N$2:$N$27,$N$2:$N$27>=Q3))
R4R4=TEXT(MIN($N:$N),"0")&"~"&TEXT(MAX($N:$N),"0")
R5R5=TEXT(MIN(FILTER(N:N,N:N<650)),"0")&"~"&TEXT(MAX(FILTER(N:N,N:N<650)),"0")
S5S5=TEXT(AGGREGATE(15,6,(N2:N100)/((N2:N100<650)*(N2:N100<>"")),1),"0")&"~"&TEXT(AGGREGATE(14,6,(N2:N100)/((N2:N100<650)*(N2:N100<>"")),1),"0")
S6S6="min~max like (" & TEXT(AGGREGATE(15,6,(N2:N100)/((N2:N100<650)*(N2:N100<>"")),1),"0")&"~"&TEXT(AGGREGATE(14,6,(N2:N100)/((N2:N100<650)*(N2:N100<>"")),1),"0") &")"
R9R9=COUNTIFS(N:N,">="&Q7,N:N,"<="&Q8)
R10R10=COUNT(N:N)
 
Upvote 0
In post #5, you mentioned…

The “This function isn’t valid“ message suggests that the FILTER function may not be available. Your profile shows two versions of Excel, with 2021 being the latest. Which version of Excel are you using when you see this error message?
Sorry about the inaccurate info, my Excel version is 2019.
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,378
Members
448,955
Latest member
BatCoder

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