+ Reply to Thread
Results 1 to 4 of 4

Year values in the column

  1. #1
    Registered User
    Join Date
    02-12-2010
    Location
    NY
    MS-Off Ver
    Excel 2019
    Posts
    47

    Year values in the column

    Hello,

    Let me explain what my data looks like, so I can ask you, good people, a question. I got 3 columns: Industry, Year and Value:

    Industry Year Value
    001 2016 8
    001 2016 11
    001 2015 12
    002 2015 7
    002 2015 6
    002 2015 1
    003 2016 4
    003 2016 9
    003 2016 3

    I need to calculate median for each industry. I know how to do that using MEDIAN and IF formulas {=MEDIAN(IF($A$2:$A$7=001,$C$2:$C$7))}

    Here is the part that I would like help with for following logic:

    If the years within the same industry are all 2016, use all values to calculate a median
    If the years within the same industry are combination of 2015 and 2106, use only 2016 values to calculate a median.
    If the years within the same industry are all 2015, use all values to calculate a median

    I think the way to do this is to create an extra column with some kind of indicator whether or not to include the value in median calculations. I'm just not sure how to do it.

    Thank you as always in advance!

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,712

    Re: Year values in the column

    Try

    =MEDIAN(IF(COUNTIFS($A$2:$A$10,1,$B$2:$B$10,2015)=COUNTIF($A$2:$A$10,1),IF($A$2:$A$10=1,$C$2:$C$10),IF($A$2:$A$10=1,($C$2:$C$10)*($B$2:$B$10=2016))))

  3. #3
    Registered User
    Join Date
    02-12-2010
    Location
    NY
    MS-Off Ver
    Excel 2019
    Posts
    47

    Re: Year values in the column

    Thank you for trying , John! Unfortunately it doesn't work. When all year values are the same (2015 or 2016) it calculates right median, but if it's a mix, it doesn't.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,712

    Re: Year values in the column

    Try

    =MEDIAN(IF(COUNTIFS($A$2:$A$10,1,$B$2:$B$10,2015)=COUNTIF($A$2:$A$10,1),IF($A$2:$A$10=1,$C$2:$C$10),IF(($A$2:$A$10=1)*($B$2:$B$10=2016),($C$2:$C$10))))

    Enter with Ctrl+Shift+Enter

+ 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. Sum values for month and year where cells in column contain word
    By serverlift in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-25-2015, 05:08 PM
  2. Replies: 4
    Last Post: 08-05-2015, 06:39 PM
  3. [SOLVED] replace year in a date with year in another column
    By kuntalnr in forum Excel General
    Replies: 3
    Last Post: 06-17-2014, 12:05 PM
  4. [SOLVED] Count values in column, paste current year in another column that many times
    By johnstevens in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-05-2014, 02:32 PM
  5. Replies: 3
    Last Post: 12-30-2010, 07:24 AM
  6. Sorting Column Values (Ascending Year)
    By jimmy_nora in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-12-2010, 04:18 AM
  7. Compare values year to year in a line graph
    By Purdue02 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 01-04-2005, 02:28 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