+ Reply to Thread
Results 1 to 8 of 8

Matching best Bid and Ask per minute

  1. #1
    Registered User
    Join Date
    02-19-2021
    Location
    Bergen, Norway
    MS-Off Ver
    Microsoft 365
    Posts
    16

    Matching best Bid and Ask per minute

    Hi,

    I would like to be able to match the best Bid and Ask per minute. In other words, i would like
    the lowest Ask to be matched with highest Bid. I've got an intraday dataset
    with ID indicating Ask and Bid (Ask=1, Bid=0), price, and timestamp down to second of the day.
    I'm not sure how it could be practically extracted, or whether an direct calculation of Bid-ask spread
    would be the best solution.

    I've attached an example with the numbers i want matched in bold. Any help would be appreciated

    Best
    ExcelNick
    Attached Files Attached Files

  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 2406
    Posts
    44,662

    Re: Matching best Bid and Ask per minute

    F2:
    =UNIQUE(ROUNDDOWN(C2:C11*1440,0)/1440)

    G2:
    =IFERROR(AGGREGATE(14,6,$B$2:$B$11/(($A$2:$A$11=0)*(ROUNDDOWN($C$2:$C$11*1440,0)/1440=$F2)),1),"")

    and similar in H2, copied down. see sheet.
    Attached Files Attached Files
    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

  3. #3
    Registered User
    Join Date
    02-19-2021
    Location
    Bergen, Norway
    MS-Off Ver
    Microsoft 365
    Posts
    16

    Re: Matching best Bid and Ask per minute

    Thank you, Glenn!

    The formula seemed to be working at the first minutes I wanted to calculate, however it started
    to skip some minutes (which had observations) and even further down the minutes I wanted to calculate it completely stopped.
    I've tried for some while to figure out why, but can't seem to get any wiser. Is there some sort of limitation to the formula?

    Also, is it possible to account for date as well as minute? I want the best bid and best offer for each minute from 04:30-18:00,
    for about a year worth of days.

    I appreciate the help and will continue trying to make the formula work

    Best
    ExcelNick

  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 2406
    Posts
    44,662

    Re: Matching best Bid and Ask per minute

    I have a problem. If I can't see it, I can't diagnose the problem.

    So....Post a sample sheet.

  5. #5
    Registered User
    Join Date
    02-19-2021
    Location
    Bergen, Norway
    MS-Off Ver
    Microsoft 365
    Posts
    16

    Re: Matching best Bid and Ask per minute

    Sorry!

    I managed to make the function work, but would still like to know how "date" can be implemented.
    I've attached an example of desired result. Hope everything is clear

    Best
    ExcelNick

  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 2406
    Posts
    44,662

    Re: Matching best Bid and Ask per minute

    the best way to deal with this is to use a date-time column, in which case columns G & H can be deleted. see file.

  7. #7
    Registered User
    Join Date
    02-19-2021
    Location
    Bergen, Norway
    MS-Off Ver
    Microsoft 365
    Posts
    16

    Re: Matching best Bid and Ask per minute

    That worked perfectly!

    Thank you very much, Glenn
    Have a nice day

    Best
    ExcelNick96

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,998

    Re: Matching best Bid and Ask per minute

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

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

+ 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. Getting the last minute from the minute() function
    By luv2glyd in forum Excel General
    Replies: 7
    Last Post: 12-04-2015, 05:25 PM
  2. how to run a macro on the minute every minute
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-19-2015, 08:33 PM
  3. [SOLVED] Record on/off time for minute by minute data set
    By bdenzer in forum Excel General
    Replies: 5
    Last Post: 07-30-2015, 07:41 PM
  4. [SOLVED] vLookup - matching minute to corresponding hour
    By domgilberto in forum Excel General
    Replies: 21
    Last Post: 06-26-2015, 12:04 PM
  5. [SOLVED] Macro that runs every minute when System Clock changes minute?
    By naira in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-18-2013, 04:11 PM
  6. Correspond Dates to Minute by Minute Data
    By chubby127 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-22-2013, 05:50 AM
  7. rolling minute data into 30 minute averages
    By grc1980 in forum Excel General
    Replies: 0
    Last Post: 08-30-2006, 03:58 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