+ Reply to Thread
Results 1 to 8 of 8

formula that searches an array

  1. #1
    Forum Contributor
    Join Date
    02-05-2013
    Location
    Oklahoma City, Oklahoma
    MS-Off Ver
    Excel for Mac 2024
    Posts
    142

    formula that searches an array

    On the morning of the Ex-Dividend Date, dividend stocks typically fall from the price the day before the Ex-dividend date by the amount of the declared dividend. The stock price then recovers back to the price (equals or exceeds) on the day before the Ex-Dividend Date, where that may take a day or many days but typically only a few days.

    I need a formula that reviews a table of historical prices and supplies (in cells T5 and T6 inside the Thick Box Borders) the number of days it takes for the price to recover. I need for the formula to also supply that number from a specific ticker symbol, where the prices are organized by ticker symbol.

    The formula I have (in cell T5) uses AGGREGATE, INDEX, MATCH, and ROW. It performs the first part (Days To Recover) but not the second part (specific to a Ticker), and thus does not work for a large table with many prices for many different Tickers.

    See workbook attached.

    I need help fixing that formula.

    Thanks for your help!

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

    Re: formula that searches an array

    Not sure 100% I can understand, but try:

    S5: Buy price
    Please Login or Register  to view this content.
    U5, recovery date
    Please Login or Register  to view this content.
    T5: day count
    Please Login or Register  to view this content.
    Quang PT

  3. #3
    Forum Contributor
    Join Date
    02-05-2013
    Location
    Oklahoma City, Oklahoma
    MS-Off Ver
    Excel for Mac 2024
    Posts
    142

    Re: formula that searches an array

    Bebo – your formulas work on the worksheet I uploaded. Thank You!

    I do not completely understand your formula for “U5, recovery date”, and if I did I probably would not need to post my question to the Forum in the first place.

    With that said, I think it will work when I apply it to a much larger worksheet, but I will need to double-check that when I do. If there is a problem, I will repost.

    Thanks again!

  4. #4
    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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,448

    Re: formula that searches an array

    If you ever want your helper to explain a formula, just ask.
    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.

  5. #5
    Forum Contributor
    Join Date
    02-05-2013
    Location
    Oklahoma City, Oklahoma
    MS-Off Ver
    Excel for Mac 2024
    Posts
    142

    Re: formula that searches an array

    Will do. Thanks!

  6. #6
    Forum Contributor
    Join Date
    02-05-2013
    Location
    Oklahoma City, Oklahoma
    MS-Off Ver
    Excel for Mac 2024
    Posts
    142

    Re: formula that searches an array

    bebo - I understand your formulas in S5: Buy price and T5: day count. The part of your "U5: recovery date" formula I don't understand is MATCH(TRUE,INDEX($L$3:$L$33/($A$3:$A$33=$N5)/($B$3:$B$33>$P5)>S5,)

    I understand the $L$3:$L$33 and the ($A$3:$A$33=$N5) and the ($B$3:$B$33>$P5)>S5; however, I don't understand using the "/" symbol. Can you please explain what the "/" symbol does?

    Thanks!

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

    Re: formula that searches an array

    Quote Originally Posted by okcsteve View Post
    I understand the $L$3:$L$33 and the ($A$3:$A$33=$N5) and the ($B$3:$B$33>$P5)>S5; however, I don't understand using the "/" symbol. Can you please explain what the "/" symbol does?

    Thanks!
    ($L$3:$L$33/($A$3:$A$33=$N5)/($B$3:$B$33>$P5)): This part combines the logical tests with array division. Here's how it works:
    The logical tests ($A$3:$A$33=$N5) and ($B$3:$B$33>$P5) produce arrays of TRUE/FALSE values.
    When you divide one array by another array in Excel, it performs element-wise division, meaning each corresponding element in the first array is divided by the corresponding element in the second array.
    So, in this case, each element in the range $L$3:$L$33 is divided by the corresponding elements in the arrays produced by the logical tests.
    INDEX(TRUE, ...): The INDEX function is then used to return the position of the first TRUE value in the resulting array from the array division operation. It effectively finds the first occurrence of TRUE in the array.
    So, the "/" symbol here is used to perform array division, dividing each element in one array by the corresponding element in another array.
    In some cases, using "/" instead of "*" can help alot. But in this case, you can use "*", with same result.

  8. #8
    Forum Contributor
    Join Date
    02-05-2013
    Location
    Oklahoma City, Oklahoma
    MS-Off Ver
    Excel for Mac 2024
    Posts
    142

    Re: formula that searches an array

    bebo - Thanks so much for the lesson in array logic and the associated syntax.

    I understand what you are saying conceptually. However, I need to sleep on it and think it through a bit more. Very helpful.

    Thanks again!

+ 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. need a formula that searches football results but only last 6
    By jono121ukk in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-11-2016, 03:24 PM
  2. formula that returns value from the same row it searches
    By Bill Ratliff in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-27-2014, 03:33 PM
  3. [SOLVED] Other was to do more then 6 searches in one formula
    By Shannon561 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-02-2014, 07:43 PM
  4. [SOLVED] =IF formula that searches text
    By financegrl in forum Excel General
    Replies: 8
    Last Post: 09-20-2012, 08:11 PM
  5. The application searches for the smallest value in the array
    By jacek890 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-15-2012, 05:22 PM
  6. Getting valid web searches and avoiding sites that contaminate web searches
    By David McRitchie in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 06-12-2006, 10:10 PM
  7. [SOLVED] FIND formula that searches from right?
    By KellyB in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-21-2005, 07:06 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