+ Reply to Thread
Results 1 to 13 of 13

Help with formula to skip NA cells & account for gaps in dates

  1. #1
    Registered User
    Join Date
    08-16-2017
    Location
    NA
    MS-Off Ver
    2010
    Posts
    9

    Help with formula to skip NA cells & account for gaps in dates

    Hi All!

    When charting the attached stock data points - how do I formulate that I want any NA data to return the figure above?
    And also, because those are stock figures, there are date gaps for weekends and holidays. How do I account for that in the chart formatted data?
    I'm still learning formulas & feel comfortable with basic Lookups, but have no clue on how to combine!

    Thanks!!

    ETA: One more thing...
    I need the chart title from resulting data to display MoM and YoY percent change like so:
    DJIA` "DJIA
    Sep 05, 2017 to Oct 05, 2017, 4.70% Increase Oct 05, 2016 to Oct 05, 2017, 24.58% Increase"

    S&P "S&P 500
    Sep 05, 2017 to Oct 05, 2017, 3.83% Increase Oct 05, 2016 to Oct 05, 2017, 18.17% Increase"
    Attached Files Attached Files
    Last edited by almat514; 10-13-2017 at 11:54 AM.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Help with formula to skip NA cells & account for gaps in dates

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).

    1. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential information is removed first!!

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    08-16-2017
    Location
    NA
    MS-Off Ver
    2010
    Posts
    9

    Re: Help with formula to skip NA cells & account for gaps in dates

    Thanks, Glenn!
    I've attached the worksheet in the original post.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Help with formula to skip NA cells & account for gaps in dates

    To be honest, I'm not sure what your problem is. Firstly, #N/A errors are ignored by Excel. Secondly, with so many datapoints, you will never see any gaps resulting from holidays.

  5. #5
    Registered User
    Join Date
    08-16-2017
    Location
    NA
    MS-Off Ver
    2010
    Posts
    9

    Re: Help with formula to skip NA cells & account for gaps in dates

    I guess in summary, I need the data from both stocks to automatically populate in a chart within one year range and for that one year range to update everytime a new date is added. It also needs to show in title what the % change is between the periods i mentioned in the original post.
    When just chart the figures, as you suggest, I get a graph with gaps & the % changes wouldn't be there (I just copied the original chart and didn't mess with the title)
    Attached Images Attached Images

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Help with formula to skip NA cells & account for gaps in dates

    Ahhhh... The penny drops... or at least begins to. It's the area plot that does it!! Weekends don't matter, the NA's do.... Is this a start in the right direction for Dow Jones?

    How are the MoM and YoY to be calculated?
    Attached Files Attached Files

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Help with formula to skip NA cells & account for gaps in dates

    I just saw post 5. We'll sort the dyamic year bit out later. lets get the right appearance first.

  8. #8
    Registered User
    Join Date
    08-16-2017
    Location
    NA
    MS-Off Ver
    2010
    Posts
    9

    Re: Help with formula to skip NA cells & account for gaps in dates

    Uh that is beautiful. It's also way nicer than the chart I had going.
    Yes.

    Thanks for naming it, dynamic year is what I want the charts to display and for the chart title to show.

    ETA: So for the MoM and YoY calculations - I want to know what the % change (increase or decrease) is between say YoY 10/12/2017 and 10/12/2016 ....and MoM 10/12/2017 and 9/12/2017. I don't know how to account for the fact that sames dates in different months/years could not exist (because it could have been a weekend/holiday)?
    Last edited by almat514; 10-13-2017 at 12:32 PM.

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Help with formula to skip NA cells & account for gaps in dates

    Next step forward.

    Two named ranges (CTRL-F3 to view). This is one of them, called "date":
    =Stocks!$P$8:INDEX(Stocks!$P:$P,MATCH(1E+100,Stocks!$P:$P))

    These automatically adjust the formula ranges down to the last row.

    I tehen modified the formulae in V & W to pull over only the last year's worth of numbers, excluding the #N/A's:

    =IFERROR(INDEX(P:P,SMALL(IF(ISNUMBER(Value),IF(Date>=EDATE(TODAY(),-12),ROW(Value))),ROWS(V$8:V8))),"")

    It's an array formula.

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...

    What's next?
    Attached Files Attached Files

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Help with formula to skip NA cells & account for gaps in dates

    Now with a dynamic legend
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    08-16-2017
    Location
    NA
    MS-Off Ver
    2010
    Posts
    9
    Quote Originally Posted by Glenn Kennedy View Post
    Now with a dynamic legend

    My goodness. I'm not sure how to thank you. Usually I'd send you a wine basket but a digital one doesn't seem as exciting.

    I can't access the full sheet now from my phone but other than the strange dates in x axis this seems to be more than I asked for. Thanks a million.
    Last edited by almat514; 10-13-2017 at 05:49 PM.

  12. #12
    Registered User
    Join Date
    08-16-2017
    Location
    NA
    MS-Off Ver
    2010
    Posts
    9
    Quote Originally Posted by Glenn Kennedy View Post
    Now with a dynamic legend

    I'll attempt to replicate your magic on the SP data & maybe learn some of this to do on my own next time. Maybe.

  13. #13
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Help with formula to skip NA cells & account for gaps in dates

    I see no value in virtual wine baskets... sadly.

    But basically...


    You're welcome.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.
    Last edited by Glenn Kennedy; 10-14-2017 at 03:37 AM.

+ 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. [SOLVED] IF Formula. Time between 2 dates taking into account Blank fields PART 2
    By Matt1998 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-25-2015, 11:31 AM
  2. [SOLVED] IF Formula. Time between 2 dates taking into account Blank fields
    By Matt1998 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-25-2015, 08:10 AM
  3. Countif Formula taking into account start dates
    By Revolution in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-15-2013, 12:17 PM
  4. [SOLVED] Overlapping Dates, Gaps in Dates, Double Counting
    By arunkushvaha in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-19-2013, 11:15 PM
  5. Formula that doesnt take into account certain dates
    By Winnie04 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-08-2013, 11:54 AM
  6. Overlapping Dates, Gaps in Dates, Double Counting
    By sglxl in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-24-2012, 02:46 AM
  7. Select latest of 3 dates and skip blank cells
    By Skully in forum Excel General
    Replies: 16
    Last Post: 06-08-2011, 04:07 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