+ Reply to Thread
Results 1 to 6 of 6

User Defined Function MAXIF and MINIF

  1. #1
    Forum Contributor
    Join Date
    08-03-2005
    Posts
    269

    User Defined Function MAXIF and MINIF

    Hi, I know that you can do a maxif with as an array as shown:

    =max(if($B$1:$G$1="Rt",$B3:$G3))

    I am having problems with that because of teh "Ctrl+Shift+Enter". We have too many cells to do this for. Is there anyway to write a function in VBA that does this?

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    If you have that formula in a continous range down a column then you shouldn't need to use CTRL+SHIFT+ENTER for each cell, just put the formula in H3, use CSE then drag down column as far as needed.

    If you have continuous data in the adjacent column you can just "double click" the "fill handle" on the bottom right of the cell and formula will automaticaly fill down as far as you have data

  3. #3
    Forum Contributor
    Join Date
    08-03-2005
    Posts
    269
    I'll try that, what if the feeding data changes, do I still need a Control Shift Enter every time?

  4. #4
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284
    You would only need to CSE it if the formula changes, not just if the feeding data changes.

  5. #5
    Forum Contributor
    Join Date
    04-21-2007
    Location
    Lima, Peru
    MS-Off Ver
    2000, 2007, 2010
    Posts
    674

    Array entry

    HI

    The following code will have the same effect as hitting shift ctrl enter

    Please Login or Register  to view this content.
    So if you can loop through the relevant cells you can convert them to array formulas.

    Regards

    Jeff

  6. #6
    Registered User
    Join Date
    07-04-2011
    Location
    bangalore, india
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: User Defined Function MAXIF and MINIF

    You can use this function
    Function SabseZyada(Kya As String, Kahan As Range)
    Arr = Range(Kahan.Address)
    For i = 1 To UBound(Arr, 1)
    If Arr(i, 1) = Kya And SabseZyada < Arr(i, 2) Then SabseZyada = Arr(i, 2)
    Next i
    End Function

    usage as =SabseZyada(A2,Q2:R3) ' First is what to look at and next is range the whole range

+ 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