+ Reply to Thread
Results 1 to 13 of 13

Can Median() be put in an Array Formula?

  1. #1
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Can Median() be put in an Array Formula?

    Hi,

    I solved this attached timecard problem a few days ago and now wonder if I could have rolled the formulas into an easier formula.

    The given numbers are the number of hours an employee works per day, for a full week. They get normal pay for the first 8 hours, time and a half for the next two hours and double time for hours over 10 in a single day. I'd like to see if my formulas in the yellow can be reduced to an array formula (or any easier method).
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,636

    Re: Can Median() be put in an Array Formula?

    Looks like it can't.
    I've come closest with this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    It evaluate array but alway end with 1st number of it (B column)

  3. #3
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Can Median() be put in an Array Formula?

    Question, why are you using median?
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Can Median() be put in an Array Formula?

    I was thinking that the Array Constant of {1,2,3,4,5,6,7} could somehow be used to array the values inside the Median formula.

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Can Median() be put in an Array Formula?

    Hey Tom,

    Good question. I saw one of the smart Guru's use Median a few months back and needed to really study to see why.

    Median mean the middle number. In the normal time a person could work 5 hours so between 0 and 8, 5 is what they get paid normal time for. Now if they worked 9 hours then the middle between 0,8 and 9 is 8! They only get paid normal time for the first 8 hours.

    I hope that makes sense, but it sure didn't when I first saw it.

  6. #6
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Can Median() be put in an Array Formula?

    OK, now it does, but, I noticed the totals don't seem to add up correctly.

  7. #7
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,636

    Re: Can Median() be put in an Array Formula?

    MarvinP you are right.
    Median is the numerical value separating the higher half of a data sample from the lower half.

    But in case of 3 numbers it's always middle one so it's shorter way to pick middle values.

    I use it mostly with dates or times. For example to check does some date fit between two dates.

  8. #8
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Can Median() be put in an Array Formula?

    The totals are on a daily basis. When I first did this problem I added all the hours for a week and was wrong. The OP wanted to pay based on daily hours.

    In my Example in Row 2, Shawn worked 6 hrs one day and 11 the next day. He was paid 6 and 8 = 14 hours at normal time. Because time and a half is between 8 and 10 hours, he got 2 hours at time and a half. Because double time is any time worked over 10 hours in a day, he got the last hour at double time.

    Does it make sense now? Change some numbers in my sample to see if my formulas work correctly.

  9. #9
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Can Median() be put in an Array Formula?

    Sorry...I may not have a grasp of what your are doing. Are you only doing toe totals for one of the days worked, or all?

  10. #10
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Can Median() be put in an Array Formula?

    Wait wait, I got it now, I see how it all works. BTW, I want to work for whatever company this is if that is how they do their pay.

  11. #11
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Can Median() be put in an Array Formula?

    Hello Marvin,

    I think you could do this without using MEDIAN

    For totals try this array formula

    =SUM(IF(B2:H2>8,8,B2:H2))

    then for Double Time

    =SUM(IF(B2:H2>10,B2:H2-10))

    Now the Overtime figure is just all the hours except those 2 columns so

    =SUM(B2:H2)-I2-K2
    Audere est facere

  12. #12
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Can Median() be put in an Array Formula?

    GREAT Answer if there are only 3 pay rates.

    What if there were 4 rates?

    Normal Time = 0 to 8 hrs
    Extra Time = 8 to 10 hrs
    Better Time = 10 to 12 hrs
    Double Time = 12 or more hours.

    Sorry I changed the problem as your answer was GREAT!

    I find many of these answers are simply how you look at the problem. DLL is still my hero. (reped)

  13. #13
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Can Median() be put in an Array Formula?

    Hey Marvin, no problem

    If you want to calculate 8 to 10 explicitly then you can use a similar formula but with an extra IF, e.g.

    =SUM(IF(B2:H2>8,IF(B2:H2-8>2,2,B2:H2-8)))

    Where the 2, of course is derived from 10-8

    Of course you can do the same for 10-12 or any other range

+ 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. Median of an Array
    By cdesantis01 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-09-2014, 01:18 AM
  2. Median of an Array
    By cdesantis01 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-08-2014, 11:59 PM
  3. [SOLVED] Median with two If statements in an array formula
    By Debbie Thomson in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-27-2013, 09:39 PM
  4. [SOLVED] Median IF OR array formula
    By alex_shin in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-13-2013, 09:26 PM
  5. [SOLVED] MEDIAN() as array function?
    By Henrik in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-11-2005, 07:05 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