+ Reply to Thread
Results 1 to 10 of 10

Conditional formatting with special conditions

  1. #1
    Registered User
    Join Date
    11-19-2020
    Location
    Zurich
    MS-Off Ver
    365
    Posts
    6

    Conditional formatting with special conditions

    Hi guys,

    I recently started with my master's thesis and I'm stuck with a small problem. I got a list of closing prices of some stocks and need to find the MAX and MIN values under certain conditions (Max and Min values for each year/quarter/month/week). I tried to do it manually, but I'm not sure if this approach is time efficient and wanted to ask if some of you guys know a better approach.

    The list looks something like this (just WAY longer and with more stocks).

    In this specific example, I selected the year manually and used conditional formatting for highest/lowest value. To save time, I'd like to select the whole list and tie the condition to the date and a time interval.
    Attached Files Attached Files

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,447

    Re: Conditional formatting with special conditions

    Hi
    for me the easiest way is to use a Pivot Table, grouping dates as required ( see attached)
    Of course there are other ways with some complicated formulas...
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    11-19-2020
    Location
    Zurich
    MS-Off Ver
    365
    Posts
    6

    Re: Conditional formatting with special conditions

    Thank you very much for your fast answer! This approach seems more time efficient. Do you maybe know if there is also a possibility to highlight the values in the table with the ones from the pivot table? Because I got to know the dates of these values and do some calculations accordingly.

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Conditional formatting with special conditions

    With year in D2:
    Use this CF in cell B4:
    Min:
    Please Login or Register  to view this content.
    Max: change 15 to 14
    In attachment is sample of year condition

    For other set of criteria,
    Year + quarter
    Year + month
    Year + week

    adapted with CF formula in relevant columns (G to N)
    Attached Files Attached Files
    Quang PT

  5. #5
    Registered User
    Join Date
    11-19-2020
    Location
    Zurich
    MS-Off Ver
    365
    Posts
    6

    Re: Conditional formatting with special conditions

    Thank you very much bebo021999! Yearly worked fine with the formula provided, but quarter, month and week not really. Based on the idea that I got to get these values for each week, I should be getting more TRUE values for quarter, month and week, which is not the case. You guys helped me so much I try to figure out whats the problem now.

    EDIT: Also found help on another website (can't post it due to restriction...) BUT they basically used the following formula for monthly max/min values: =MAX(IF((YEAR($B$3:$B$16)= YEAR($B3))* (MONTH($B$3:$B$16)=MONTH($B3)), $C$3:$C$16, ""))=$C3

    This approach seems easier, but I cannot figure out how to do it for quarterly and weekly Min/Max values.
    Last edited by Zanto666; 11-20-2020 at 09:22 AM.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,800

    Re: Conditional formatting with special conditions

    Please post a link to the forum where you got help (see the rules on cross-posting). You can post the link with a few spaces in it.

    No further help until this has been added.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  7. #7
    Registered User
    Join Date
    11-19-2020
    Location
    Zurich
    MS-Off Ver
    365
    Posts
    6

    Re: Conditional formatting with special conditions

    Found the main formula here: w.w w.get-digital-help.c om/how-to-highlight-max-and-min-value-in-every-month-in-excel/

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: Conditional formatting with special conditions

    Thank You for posting the link to the tutorial. The formula used there and given in post #5, uses the MIN and MAX functions which can be replaced by AGGREGATE as bebo explained.
    I have modified bebo's formulas so that they will do what I believe that you want:
    For Year: =$B4=AGGREGATE(15,6,$B$4:$B$50/(YEAR($A$4:$A$50)=YEAR($A4)),1)
    For Quarter: =$B4=AGGREGATE(15,6,$B$4:$B$50/(YEAR($A$4:$A$50)=YEAR($A4))/($D$4:$D$50=$D4),1)
    Note that the formula for quarter references a helper column (D) which is populated using: =ROUNDUP(MONTH(A4)/3,0)
    For Month: =$B4=AGGREGATE(15,6,$B$4:$B$50/(YEAR($A$4:$A$50)=YEAR($A4))/(MONTH($A$4:$A$50)=MONTH($A4)),1)
    For Week: =$B4=AGGREGATE(15,6,$B$4:$B$50/(YEAR($A$4:$A$50)=YEAR($A4))/($C$4:$C$50=$C4),1)
    Note that the formula for week references a helper column (C) which is populated using: =WEEKNUM(A4)
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  9. #9
    Registered User
    Join Date
    11-19-2020
    Location
    Zurich
    MS-Off Ver
    365
    Posts
    6

    Re: Conditional formatting with special conditions

    JeteMc thank you very much for your time and efforts! Sorry for not responding right away. You guys all helpmed me very much and I'm really grateful for your help! Couldn't get it done by my own.

    This thread can be closed now.

  10. #10
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: Conditional formatting with special conditions

    You're Welcome and thank you for the feedback. Please take a moment to mark the thread as 'Solved' using the thread tools menu above your first post. I hope that you have a blessed day.

+ 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. Conditional Formatting - something special
    By worboysn in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-19-2017, 03:15 PM
  2. Replies: 2
    Last Post: 10-03-2016, 08:35 AM
  3. [SOLVED] Special conditional formatting
    By dominatro in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-22-2016, 12:54 PM
  4. Conditional Formatting, VBA and Paste Special
    By lross in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-11-2011, 07:49 PM
  5. Conditional Formatting with special characters
    By Climaxgp in forum Excel General
    Replies: 7
    Last Post: 08-24-2009, 09:32 AM
  6. Copy>Special>Format: Not for Conditional Formatting?
    By Ingeniero1 in forum Excel General
    Replies: 2
    Last Post: 03-31-2006, 10:28 AM
  7. Replies: 1
    Last Post: 08-22-2005, 09:05 AM

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