+ Reply to Thread
Results 1 to 21 of 21

Formula to Extract Unique Data

  1. #1
    Registered User
    Join Date
    11-01-2013
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    31

    Formula to Extract Unique Data

    Hi All,

    I have three sheets in the link of my sample data.

    Rules sheet: Fixed template that does not change.

    TB sheet: On a quarterly basis I receive a text file (i.e. column A) and I dump it to column A. I would like to extract the unique GL's and sum their amounts. The current formula that I have in column D and E is taking the GL's from the text file then lookups and matches it with the GL's in the "Rules" sheet (D3:D6). However, this is incorrect because the formula needs to FIRST needs to lookup the GL from D3:D6 THEN get the corresponding SGL from the "Rules" sheet (E3:E6). Essentially, the SGL's are the unique account # not the GL's that should be showing in the extraction formula. For example, you can see that GL 102400 rolls up to SGL 101000 in the "Rules" sheet but my current formula shows "No match" for it.

    Expected Results sheet: This is what the "TB" extraction results should look like.

    I would like to avoid using helper columns if possible.

    https://app.box.com/s/0n9qvwdivk1p6yk8d8020mqi6d1gyh90

    Please let me know if you have any further question. TIA!
    Last edited by Legalhustler; 06-04-2015 at 10:37 AM.

  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,929

    Re: Formula to Extract Unique Data

    Hi, welcome to the forum

    Please upload your workbook to the forum, not all members are able - or willing - to load files from file hosting sites.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    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
    Registered User
    Join Date
    11-01-2013
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Formula to Extract Unique Data

    Hi. Thanks - see attached sample data.
    Attached Files Attached Files

  4. #4
    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,929

    Re: Formula to Extract Unique Data

    I suggest you import that text file using csv, to break out the different column values. you could work with it like that, but it would require a bunch of formulas to separate the text string into columns

  5. #5
    Registered User
    Join Date
    11-01-2013
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Formula to Extract Unique Data

    Quote Originally Posted by FDibbins View Post
    I suggest you import that text file using csv, to break out the different column values. you could work with it like that, but it would require a bunch of formulas to separate the text string into columns
    I think I'm just looking for a way to revise my current formula not necessarily modifying my text file, I mean I'm very close to getting the results that I need, you can see that by comparing the results in the "TB" sheet vs "Expected Results" sheet. I just need help tweaking the formula so that if the GL from the text file matches the GL from the "Rules" sheet (D3:D6) then it return the corresponding SGL (E3:E6).

  6. #6
    Registered User
    Join Date
    11-01-2013
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Formula to Extract Unique Data

    I am using an ERP system called SAP and downloading finance data into Excel.
    The finance data is keyed on General Ledger account (GL) number. For whatever reason, the GL numbers in the system do not group the data as we would like for reporting. So, we have invented a new number (SGL) which defines the "correct" groupings.
    What is now needed is a mapping from GL to SGL via using extraction formula.

  7. #7
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Formula to Extract Unique Data

    Wih text to column.

    After that a helpcolumn (see yellow cells).

    After that a pivot table.

    See the attached file.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  8. #8
    Registered User
    Join Date
    11-01-2013
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Formula to Extract Unique Data

    If I create a pivot table after your text to column method it would give the incorrect results, because as I mentioned per the "Rules" sheet certain GL's roll up to SGL's. For example, 102400 rolls up to 101000 (Also see my note on post #6). Put your data in a pivot and see if you get the same results as the "Expected Results" sheet.

    My data is much larger and once I have my formula corrected it will be part of a larger formula that will do different reconciliations based on a drop-down validation list. Thus, I prefer to stick with a single formula to do the extraction. I am almost there, you can see it by comparing my results from the "TB" sheet with the results from the "Expected Results" sheet.

    Thanks.

  9. #9
    Registered User
    Join Date
    11-01-2013
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Formula to Extract Unique Data

    I just saw that you created the pivot table. You can see your results are different from my expected results. Since my data is larger and I have many different worksheets, it will slow down calculation process if I have so many different formulas.

  10. #10
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Formula to Extract Unique Data

    Just added VLookup.

    See the attached file (the pivot table).

  11. #11
    Registered User
    Join Date
    11-01-2013
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Formula to Extract Unique Data

    Thanks - I've tried the route your are speaking of but I have many sheets in my workbook and it will take a very long time to do the calculations/processing. Is there anyway to revise my formula in the "TB" sheet to get the expected results? I would like to avoid helper columns as much as possible.

  12. #12
    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,929

    Re: Formula to Extract Unique Data

    I would like to avoid helper columns as much as possible.
    why? they can save a LOT of calc, and keep formulas simple...they can be hidden if needed

  13. #13
    Registered User
    Join Date
    11-01-2013
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Formula to Extract Unique Data

    Quote Originally Posted by FDibbins View Post
    why? they can save a LOT of calc, and keep formulas simple...they can be hidden if needed
    It's sort of complicated for me to explain, but I need to have a clean sheet with just one big formula. The formula once fixed is part of a bigger nested if formula that does a reconciliation based on a drop-down. Generally, hiding formulas still affects the processing/opening/calculations of workbooks.

  14. #14
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Formula to Extract Unique Data

    @Legalhuster

    I seen a lot of reactions like yours, and (but) believe me, I would solve it with a pivot table.

    Fast, reliable, and easy to generate for data-analyze.

  15. #15
    Registered User
    Join Date
    11-01-2013
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Formula to Extract Unique Data

    I originally did it with a pivot table, but calculations were just too slow, and I did it for several other sheets in my workbook. Don't get me wrong, I love PT's, but it's just not the most suitable way for my current condition. Beside, if I hand my workbook to someone else in the office, they barely know how to use pivot tables. I'm trying to make it as intuitive and fast as possible via a drop-down validation list - no brains required there, just dump the text file in the worksheet and select from a drop down to do the reconciliation.

    The text files also had to be reformatted via formulas so I have formulas that fixed the text file in the correct format too.
    Last edited by Legalhustler; 06-04-2015 at 03:09 PM.

  16. #16
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Formula to Extract Unique Data

    have a clean sheet with just one big formula

    no brains required there

    And if one of the members delete the formula, it is easy to repair?

    I originally did it with a pivot table, but calculations were just too slow,

    In that case I would like to know how fast your calculations are with your big formula.

  17. #17
    Registered User
    Join Date
    11-01-2013
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Formula to Extract Unique Data

    I have a script that backups the file via windows task scheduler from the server, so no worries about having to repair anything. My big nested array formula is not complete yet but I know it'll be faster, because if you base it on a drop-down, when the IF formula's return a false, then the rest of the formula's don't get calculated, thus does not affect the speed of my worksheet/workbook.

    I'm also saving on the file size of my workbook if I don't create helper columns etc.

    I'm assuming it's too complicated to update my formula to get the results I want.....

    Thanks.

  18. #18
    Registered User
    Join Date
    11-01-2013
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Formula to Extract Unique Data

    Can anyone fix my formula?

    You can see that when you highlight and evaluate (press F9) the beginning part of formula (see below) the unique count is off. It results in 5 instead of 4 since there are 4 unique GL's as you can see in the "Expected Results" sheet. This is because again GL 1024000 rolls up to 101000 per the "Rules" sheet.

    SUM(IF(FREQUENCY(MATCH(MID(VAATB,Rules!$I$3,Rules!$G$3),MID(VAATB,Rules!$I$3,Rules!$G$3),0),ROW(VAATB)-ROW($A$2)+1),1))

    Thanks in advance.

  19. #19
    Registered User
    Join Date
    11-01-2013
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Formula to Extract Unique Data

    **BUMP***

    Anyone??

  20. #20
    Registered User
    Join Date
    11-01-2013
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Formula to Extract Unique Data

    My last call. If anyone can help.

    Thanks.

  21. #21
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Formula to Extract Unique Data

    Please Login or Register  to view this content.
    The Array formula is rather straightforward:

    PHP Code: 
    =SUM((MID(A$2:A$12;29;6)="610000")*MID(A$2:A$12;36;20)*(1-2*(MID(A$2:A$12;56;1)="C")))/100 
    Last edited by snb; 07-16-2015 at 12:31 PM.



+ 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] How to extract unique data from two columns
    By Xiaojiang in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-22-2013, 08:07 AM
  2. [SOLVED] Formula to Extract Unique Values
    By bjnockle in forum Excel Formulas & Functions
    Replies: 29
    Last Post: 07-31-2013, 05:18 PM
  3. Extract unique dates from a list through formula only
    By maniknandi in forum Excel General
    Replies: 7
    Last Post: 07-29-2013, 02:48 AM
  4. Extract unique data and concatenate
    By Dyzone in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-19-2011, 03:32 AM
  5. Excel 2007 : extract Unique Data Problem
    By Hammad in forum Excel General
    Replies: 0
    Last Post: 02-10-2010, 01:25 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