AMIN,AMAX

=AMIN(a,ns)

a
array
ns
nothing, always ignored, any number set by mistake will be ignored. string will get an error

calculates MIN or MAX for each row of an array

Xlambda

Well-known Member
Joined
Mar 8, 2021
Messages
860
Office Version
  1. 365
Platform
  1. Windows
AMIN,AMAX !! recursive !! array min, array max, calculates MIN or MAX for each row of an array, calls APPEND2V
Important NOTE: all my recursive function can be written also non recursive. So far, lambda being in beta, has a limited nr. of iterations, (200 to 300) (has nothing to do with nr. of iterations found under Options Formulas). When a recursive formula excedes the nr. of iterations will get the #NUM error. I choose the recursive path for any formula possible, apart for being short simple and elegant, to help anybody who wants, to get familiarized with the concept.

AMIN:
Excel Formula:
=LAMBDA(ar,ns,
    LET(s,--ns,n,ROWS(ar),c,COLUMNS(ar),x,MIN(INDEX(ar,n,)),
       IF(n=1,INDEX(APPEND2V(x,s,),SEQUENCE(ROWS(s))),AMIN(INDEX(ar,SEQUENCE(n-1),SEQUENCE(,c)),APPEND2V(x,s,)))
    )
)
AMAX:
Excel Formula:
=LAMBDA(ar,ns,
    LET(s,--ns,n,ROWS(ar),c,COLUMNS(ar),x,MAX(INDEX(ar,n,)),
        IF(n=1,INDEX(APPEND2V(x,s,),SEQUENCE(ROWS(s))),AMAX(INDEX(ar,SEQUENCE(n-1),SEQUENCE(,c)),APPEND2V(x,s,)))
    )
)
LAMBDA 6.0.xlsx
ABCDEFGHIJKL
1sample=AMIN(A2:F5,)check=AMAX(A2:F5,)check
225-2-9301731-93-933131
3-8663988-11-85-86-868888
46756-86-3042-77-86-866767
5-592032-15-45-77-77-773232
6
7text,blanks,logical, ignored like main MIN and MAX work in Excel=AMIN(A8:F11,)check=AMAX(A8:F11,)check
8text-202b-2-222
9-3FALSETRUE3text-3-333
10abcdef0000
11TRUETRUEFALSEFALSETRUEFALSE0000
12
AMIN,AMAX post
Cell Formulas
RangeFormula
H1,J7,H7,J1H1=FORMULATEXT(H2)
H2:H5,H8:H11H2=AMIN(A2:F5,)
J2:J5,J8:J11J2=AMAX(A2:F5,)
I2:I5,I8:I11I2=MIN(A2:F2)
K2:K5,K8:K11K2=MAX(A2:F2)
Dynamic array formulas.
 
Last edited by a moderator:
Upvote 0
This wouldn't be Exceλambda would it? Great LAMBDAs.

The iteration problem doesn't seem to affect ones without an n argument. I can confirm the issue doesn't seem to be affected by the iterative calculation option. I turned it on it set to many many more iterations than the loop would ever need and it still fails. I have a recursive REVERSE function that fails at 65 cells (each cell is reversed individually)

I made a SUBCHARS function that loops if the old text string isn't empty. This works for any size array. I used a RANDARRAY to generate a list of random numbers from 1 to 1048576 (max excel rows) by 5 columns). The calculation performs just fine but does obviously take time to calculate that much data
 
Hi schardt679, yes, it's me. Here, Greek chars in username was not allowed.
"Enable iterative calculation", found in Option, Formulas, indeed, has nothing to do with iterations in recursive lambdas. Could be on or off, lambdas have their own engine. Hope that, after beta, will get some settings for it. In some scenarios you will never exceed the number of iterations, in others you will. My main concern is to make them work properly, as case studies. The exit condition is particularly important.
Regarding extra arguments, they are needed, even if are ignored at the beginning, they are vectors that get transformed during iterations and are carrying the result. Sometimes they can be an extra super useful tool, sometimes not.
If you have formulas, post them here to check them out. Have fun and thanks for the comment. ?✌
 
I thought so. It seems so random for when the NUM error occurs. Anyways, how do I get posting privileges. Currently it says I have insufficient privileges to post formulas. I have a lot to post.
 
Great, you made it!!✌?
 

Forum statistics

Threads
1,223,575
Messages
6,173,148
Members
452,502
Latest member
PQCurious

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