+ Reply to Thread
Results 1 to 8 of 8

Using comma separated values in a single cell

  1. #1
    Registered User
    Join Date
    01-14-2015
    Location
    Anywhere, USA
    MS-Off Ver
    2013
    Posts
    3

    Using comma separated values in a single cell

    Be easy, first time poster. I'm creating a spreadsheet to track my stocks and having trouble solving a problem with a Ledger calculation. The url to an example spreadsheet is: https://docs.google.com/spreadsheets...it?usp=sharing. As you can see from the example spreadsheet, I have assigned Transaction Id's to each block of stocks sold, bought, or dividends received. Assigning id's to each block allows me to pick and choose which block of shares I want sell for purposes of calculating a cost basis. My question is how do I make a calculation based on a cell that has the values of '3,4,5' (without the ''). The calculation, in the provided example for Cell J6, would need to be G6-G3-G4-G5. Make sense?

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Using comma separated values in a single cell

    Hi, welcome to the forum

    Im not sure if that file is protected or what (I dont use google docs much), but I am unable to type anything into it.

    Besides, please upload your workbook to the forum, not all members are able - or willing - to open files like that.

    THis will kinda do what you want, but you need to enter the values into the formula manually...
    G
    H
    I
    J
    2
    1
    3
    [BGCOLOR=#FFFFFF]6[/BGCOLOR]
    3
    2
    3
    4
    3
    4
    5
    4
    5
    6
    5
    6
    7
    6
    1

    J2=SUM(SUMIF(H2:H10,{3,4},G2:G10))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Using comma separated values in a single cell

    I don't know how Google's spreadsheet works but a formula like this might be what you are looking for using the cell references in your displayed worksheet.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  4. #4
    Registered User
    Join Date
    01-14-2015
    Location
    Anywhere, USA
    MS-Off Ver
    2013
    Posts
    3

    Re: Using comma separated values in a single cell

    Wasn't exactly sure how to post a table, but here is an attempt at a table:

    B C D E F G H I J
    Date Trans Type Symbol Shares Price Total TransID Blocks Sold Profit & Loss
    1/5/15 buy goog 100 500 50000 3
    1/6/15 buy goog 100 500 50000 4
    1/10/15 dividend goog 5 505 2525 5
    1/14/15 sell goog 205 520 106600 6 3,4,5

    Basically, I need to know how to read in the values of 3,4,5 in I6 to calculate my P&L. This is similar to for loops (for iin $variable, do) Bash Scripting (not sure if there are any Linux user on this forum).
    Last edited by joerobb; 01-15-2015 at 02:14 PM.

  5. #5
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Using comma separated values in a single cell

    If you are just wanting to identify the rows as indicated in I6 This formula entered in I3 (assuming data starting in row 3) and filled down will put an X in where there is a match.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This will enter the profit/loss in column J

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    As far as the profit and loss calculation is concerned, I think that I already gave that to you in my previous message. If you are wanting to calculate that for each row. This will work for each row except for Dividends where you will want to add the total amount.

  6. #6
    Registered User
    Join Date
    01-14-2015
    Location
    Anywhere, USA
    MS-Off Ver
    2013
    Posts
    3

    Re: Using comma separated values in a single cell

    Thanks for the input newdoverman (&FDibbins). Your first post does work, but will not fulfill all the possible scenarios of my stock transactions. BUT, I think your post second postgot the wheels turning. Since I have 100's of stock transactions per year I need to have uniqueness to each transaction. I can reverse my current spreadsheet logic to assign transID's to only sells and then associate those transID's with the buys and divy's. Awesome, thanks for y'alls help with this problem.
    Joe
    Last edited by joerobb; 01-15-2015 at 02:56 PM. Reason: Marked solved.

  7. #7
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Using comma separated values in a single cell

    I'm glad to have helped. Thanks for the feedback.

  8. #8
    Registered User
    Join Date
    01-01-2015
    Location
    India
    MS-Off Ver
    2010
    Posts
    15

    Re: Using comma separated values in a single cell

    send any example..

+ 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. Match a Value from a single-cell, comma separated list
    By secondchild12 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-24-2014, 06:16 PM
  2. [SOLVED] Facing problem in a Macro which compares 2 columns having comma separated / single values
    By Manish_Gupta in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-18-2014, 11:18 PM
  3. Replies: 3
    Last Post: 12-23-2013, 12:32 PM
  4. [SOLVED] Single cell Comma Separated Values to validation list [DIFFICULT QUESTION]
    By jgema in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-31-2013, 08:48 PM
  5. Column/cells to single cell comma separated data?
    By egeorge4 in forum Excel General
    Replies: 1
    Last Post: 04-27-2007, 03:53 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