• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Grouped running balances & average cost, Gain& Loss|General Excel Questions & Answers|Excel Forum|My Online Training Hub

You are here: Home / Grouped running balances & average cost, Gain& Loss|General Excel Questions & Answers|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumGeneral Excel Questions & Answe…Grouped running balances & aver…
sp_PrintTopic sp_TopicIcon
Grouped running balances & average cost, Gain& Loss
Avatar
ARUN KAINTH
Member
Members
Level 0
Forum Posts: 9
Member Since:
March 15, 2021
sp_UserOfflineSmall Offline
1
March 24, 2021 - 1:35 pm
sp_Permalink sp_Print

Hi,

Can anyone help to write formulas to automatically calculate grouped running calculations to fill columns H, I and J. I have attached file to with notes. Thanks

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4449
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
2
March 24, 2021 - 2:17 pm
sp_Permalink sp_Print

Hi Aarun,

You can use SUMIFS for these calculations. See file attached.

Mynda

Avatar
ARUN KAINTH
Member
Members
Level 0
Forum Posts: 9
Member Since:
March 15, 2021
sp_UserOfflineSmall Offline
3
March 26, 2021 - 1:18 pm
sp_Permalink sp_Print

Hi Mynda,

Thanks for your quick response always.

Sorry for delayed reply.

Yes your SUMIFS did the job to Balance Qty but didn't gave desired results for other two when I compare with my manual calculation done for ticker GME. I am uploading workbook again with more worksheet named Adjusted Cost Basis. Also I have added one more column H to Ledger worksheet which can be calculated same as in Adjusted Cost Basis sheet. 

I think formula need some function which should use old date first. 

I tried to use XLOOKUP after I watched your vide which gives some option to use dates but still a puzzle for me to get results for my needs.

Your further help will be greatly appreciated. 

Thank you,

 

Aarun 

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4449
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
4
March 26, 2021 - 6:27 pm
sp_Permalink sp_Print

Hi Aarun,

The formula does use the old date first because the data is sorted by the 'Symbol' and then the 'Date& time' column in ascending order. I see some hard keyed values in columns M:N of the ledger, but you haven't explained how these were calculated, so they don't help me understand what you're expecting to see.

The dates in the Adjusted Cost Basis sheet for the GME transactions are different to the dates in your ledger. Perhaps this is the problem.

Mynda

Avatar
ARUN KAINTH
Member
Members
Level 0
Forum Posts: 9
Member Since:
March 15, 2021
sp_UserOfflineSmall Offline
5
March 29, 2021 - 3:09 pm
sp_Permalink sp_Print

Hi Mynda,

Hope you had a great weekend.

I fixed the data now, please help to calculate now col J K L for table ACB so it gives results as per table below on row 30.

Please add commission amount in also for Col K & L

 

I tried and learned to write simple SUMIFS in Col PQRS but have 2 questions;

  1.  Why my formula is adding table name whereas your doesn't?  When I tried to remove table name it gives error. Your formulas are in Green and mine in Orange on rows 25 - 30.  
  2.  How to add commission amount in Col R & S ?

Thank you. 

Arun 

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4449
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
6
March 29, 2021 - 9:26 pm
sp_Permalink sp_Print

Hi Arun, 

No file uploaded. Please click the 'start upload' button after selecting your file and then wait for the message in green below the attachment box to let you know it has completed uploading.

Mynda

Avatar
ARUN KAINTH
Member
Members
Level 0
Forum Posts: 9
Member Since:
March 15, 2021
sp_UserOfflineSmall Offline
7
March 30, 2021 - 10:12 am
sp_Permalink sp_Print

Hi Mynda,

 

Sorry I couldn't recognize that didn't got uploaded properly; but now attached. 

Arun 

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4449
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
8
March 30, 2021 - 5:02 pm
sp_Permalink sp_Print

Hi Arun,

Thanks for clarifying. Some of these calculations are not designed to be performed in a table that contains different symbols. If you look at the formulas in columns I and J of your GME table (starting on row 31) you'll notice that the formulas are different for the first row (row 33) than they are for the rest of the rows in the table. It's for this reason that you cannot have one formula in a table that contains multiple different symbols. Tables are designed to have the same formula in every row. 

On top of that there is some ambiguity e.g. 150 AMC shares are purchased, then 129 are sold, then a further 133 are purchased. How does Excel know which price to apply to which bundle of shares sold. It's a messy conundrum and you need to be very clear on the logic you want applied.

In the attached file I've added a column for 'Batch'. This allows you to group the shares into bought & sold batches. When you sell part of a batch you must split that transaction out into two rows, one containing the number of shares sold and one containing the balance of shares still held. You'll see I've done this with AMC purchased and sold on 9th March.

These batch numbers allow you to group the data into like bundles for the purpose of calculating the average cost and gain/loss in columns K & L. See file attached.

To answer your question about the table name: when a formula is inside a table the name of the table isn't necessary as it is inferred that the formula is referencing a column in the current table. However, if your formula is outside of the table then you must explicitly reference the table name and column so Excel knows which table you're referring to.

Mynda

Avatar
ARUN KAINTH
Member
Members
Level 0
Forum Posts: 9
Member Since:
March 15, 2021
sp_UserOfflineSmall Offline
9
April 6, 2021 - 10:34 pm
sp_Permalink sp_Print

Sorry for delayed reply.

Thank you very much Mynda for all your time & help in the matter. This should help. 

Once again, truly appreciate what you are doing for all; especially novices. 

I will definitely come back here next time whenever help is needed. 

Arun 

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Velouria, Wesley Burchnall, Emma Klonowski, Kelly smith
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 871
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
Jessica Stewart: 204
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Murat Hasanoglu
Brett Dryland
Saeed Aldousari
Bhuwan Devkota
Kathryn Patton
Maria Conatser
Jefferson Granemann
Glen Coulthard
Nikki Fox
Rachele Dickie
Forum Stats:
Groups: 3
Forums: 24
Topics: 6222
Posts: 27291

 

Member Stats:
Guest Posters: 49
Members: 31913
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.