+ Reply to Thread
Results 1 to 3 of 3

Find Average Difference of 2 Columns Based on Criteria from 2 Other Columns

  1. #1
    Registered User
    Join Date
    07-08-2022
    Location
    Los Angeles, CA
    MS-Off Ver
    2016
    Posts
    12

    Find Average Difference of 2 Columns Based on Criteria from 2 Other Columns

    Hello,

    Can someone please help me derive a formula to take the difference between two columns and find the average, based on two separate column parameters please? I would like the formulas to produce the following results:

    1. Average hold time for long trades. Average of difference between column D and C, based only on column A and F. Cannot count trades with same number more than once (column A) and F must be "Long"

    2. Average hold time for specific instrument. Average difference between column D and C, based only on column A and G. Cannot count trades with same number more than once (column A) and G must be "NQ" If this formula is the same as #1., please let me know and I will fill in what's needed.

    3. Avereage hold time in month of May only. Average of difference between column D and C, based only on column A and B. Cannot count trades with same number more than once (column A) and B is are all those applicable trades in May.

    4. Total # of trades in May. Count all trades in May but don't count trades with same number (column A) more than once.

    5. Count all the losing trades (column I) in May, but not the trades with the same number more than once (column A)

    Please include the entire table including blanks and have formulas ignore blanks. All answers are adjacent highlighted cells where formulas would be entered. Let me know if there's any questions or need for clarification.

    Thank you in advance!
    Attached Files Attached Files

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

    Re: Find Average Difference of 2 Columns Based on Criteria from 2 Other Columns

    My first suggestion is to convert the data range into an Excel table and add a column to identify the first occurrence of a trade.
    1. Added column is populated using: =COUNTIFS(A$2:A2,A2)=1
    2. For Average hold time for long trades:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    3. For Average hold time for specific instrument:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    4. For Avereage hold time in month of May:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Note that N1 contains the date: 5/1/2022
    5. For Total # of trades in May: =COUNTIFS(tblTrades[First Occurrence],TRUE,tblTrades[Date],">="&N$1,tblTrades[Date],"<="&EOMONTH(N$1,0))
    6. For Count all the losing trades in May: =COUNTIFS(tblTrades[First Occurrence],TRUE,tblTrades[Date],">="&N$1,tblTrades[Date],"<="&EOMONTH(N$1,0),tblTrades[Win/ Loss],"Loss")
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  3. #3
    Registered User
    Join Date
    07-08-2022
    Location
    Los Angeles, CA
    MS-Off Ver
    2016
    Posts
    12

    Re: Find Average Difference of 2 Columns Based on Criteria from 2 Other Columns

    Thank you JeteMc. Are there formulas that would work without changing it to a data table and adding that new column?

+ 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] Average last n values based on criteria from 2 columns
    By cojohnst5412 in forum Excel General
    Replies: 9
    Last Post: 11-02-2021, 01:28 PM
  2. Replies: 2
    Last Post: 08-16-2020, 09:46 PM
  3. [SOLVED] Average Based on Multiple Criteria in Same and Different Columns
    By KoolKatelyn in forum Excel Formulas & Functions
    Replies: 28
    Last Post: 02-20-2018, 02:15 PM
  4. Getting an average across columns based on criteria.
    By anthony1312002 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-30-2017, 03:06 PM
  5. Average of difference between columns
    By magicalmarshmallow in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-31-2014, 03:55 PM
  6. Calculate average difference between two columns of data [if criteria is met]
    By samcdavies in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-29-2013, 04:56 AM
  7. [SOLVED] Average Based on Criteria in Multiple Columns
    By sinspawn56 in forum Excel General
    Replies: 2
    Last Post: 07-31-2012, 01:27 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