+ Reply to Thread
Results 1 to 14 of 14

Macro removes duplicates but Charts blanks - Help needed

  1. #1
    Registered User
    Join Date
    09-01-2012
    Location
    West Midlands, UK
    MS-Off Ver
    Excel 2010
    Posts
    16

    Smile Macro removes duplicates but Charts blanks - Help needed

    Hi,

    I am new to the forum and although not new to Excel haven't used it in depth before. Anyhow, what started as a small work project has become a bit of an obsession, I have one small and nagging problem to solve.
    I have setup a template that produces 12 charts when Data is pasted into worksheet1. some of the charts are formula driven and some are Macro driven. I want the whole process of producing the charts to be as automated as possible.

    The one chart I am stuck with takes the Data (a list of names) from Row E of worksheet1 and copies it into Column A of worksheet2 (can range from 5 names to 1000) . column B of the same worksheet then looks at Column A and counts how many times each name appears. So I then have a list of names and how many times each name appears. I then have a Macro that removes the duplicates of the names and only shows unique Data and displays the data in a table - so far this is all okay.

    The problem lies with the chart , I set the chart up by inserting a chart that took all the data from column A2 to A1000 - to allow for the max amount of data possible .After the duplicates are removed the chart is plotting the Blanks (it's a bar chart) . I don't have any option in the table to remove blanks. I am sure there is formula or a way of doing this , at the moment Iam playing with the idea of if the cell is empty inputting NA into the cell and then hopefully can remove this via the table but I am stuck with the Formula.

    Any help would be greatly appreciated as i have been stuck on it for two weeks now. Apologies for long winded write up and hope I have put this in the correct forum.

    Thanks

  2. #2
    Registered User
    Join Date
    09-01-2012
    Location
    West Midlands, UK
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Macro removes duplicates but Charts blanks - Help needed

    I think I may be recording the macro in the wrong order, is there a way once I have recorded the macro to look at the code and only plot the chart to the end of the String?

  3. #3
    Registered User
    Join Date
    09-01-2012
    Location
    West Midlands, UK
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Macro removes duplicates but Charts blanks - Help needed

    Giving this a bump in case any one can help me get this resolved for Monday.

  4. #4
    Registered User
    Join Date
    09-01-2012
    Location
    West Midlands, UK
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Macro removes duplicates but Charts blanks - Help needed

    Any ideaS? Must be a way of not plotting blank cells in excel 2010.

  5. #5
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Macro removes duplicates but Charts blanks - Help needed

    Hi agricola & Welcome to the forum,

    Sorry your thread has not received any attention, but this is the weekend and traffic tends to be a little slower than during the week so please be patient.

    Usually we recommend you bump a thread after about 24 hours of non-activity, but you bumped the thread a little less than two hours after the original post. What this does is it raises the post count on the post and some may just skip over it because it seems to have some action.

    Anyway, my first thought, why not make to range dynamic so the chart will only show the data in the range and not the entire range.

    See if this sample helps, but if it doesn't hit the mark then a sample may be necessary.

    Note: Add more data below the last entry
    Attached Files Attached Files
    Last edited by jeffreybrown; 09-02-2012 at 01:25 PM.
    HTH
    Regards, Jeff

  6. #6
    Registered User
    Join Date
    09-01-2012
    Location
    West Midlands, UK
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Macro removes duplicates but Charts blanks - Help needed

    Hi Jeff,

    Thanks for the information, this could well be the answer I am looking for, just reading up about it now and will give it a shot in the next couple of hours, Thanks very much for the help. i will report my progress,


    cheers

  7. #7
    Registered User
    Join Date
    09-01-2012
    Location
    West Midlands, UK
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Macro removes duplicates but Charts blanks - Help needed

    Seem to be getting somewhere with the Dynamic Charts , apologies again for long winded explanation but Were I have got too

    column a = 'name'
    column b = 'calls'
    define name 'name' =OFFSET(Sheet1!$A$1,1,0,COUNTA(Sheet1!$A:$A)-1,1)
    define name 'calls' =OFFSET(Sheet1!$B$1,1,0,COUNTA(Sheet1!$B:$B)-1,1)
    i can get he chart to update dynamically with the calls but it does not display the name on the 'x' axis.


    i think this will work as tested it with the formulas in place in my Cells A2:A1000 and it plots the data accordingly accept it doesn't dislay the name.

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Macro removes duplicates but Charts blanks - Help needed

    I updated the sample (post #5) to hopefully answer your concerns.

  9. #9
    Registered User
    Join Date
    09-01-2012
    Location
    West Midlands, UK
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Macro removes duplicates but Charts blanks - Help needed

    Hi Jeff,

    This works perfectly, I have put my formulas in place and all seems to work well.

    As i am knew to the Dynamic charts I would like to check I have the correct way that you obtained this result, is there any chance you could give me a brief summary of how you achieved it, I tried to replicate the reuslt but as mentioned above don't seem to be getting the month on the x axis although it will plot the total.

    many many thanks

    Dave

  10. #10
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Macro removes duplicates but Charts blanks - Help needed

    No problem Dave. Here are the steps. Hope they help…

    Step 1 >> create the two named ranges which is seems you have a handle on, but, just in case…

    Ctrl + F3 (Opens Name Manager)

    New…
    Name: calls
    Refers to: =OFFSET(Sheet1!$B$1,1,0,COUNTA(Sheet1!$B:$B)-1,1)

    New...
    Name: name
    Refers to: =OFFSET(Sheet1!$A$1,1,0,COUNTA(Sheet1!$A:$A)-1,1)

    Step 2 >> Highlight A1:B8

    Step 3 >> Insert >> Column >> 2-D Column >> Clustered Column

    Step 4 >> Right click on chart >> Select Data

    Step 5 >> On the Select Data Source dialogue box select the Call Legend and Edit

    Update the Series values
    Before >> =Sheet1!$B$2:$B$8
    After >> =Sheet1!calls
    Select OK

    Step 6 >> On the Select Data Source dialogue box select the Update Horizontal (Category) Axis Labels and Edit

    Update the Axis label range
    Before >> =Sheet1!$A$2:$A$8
    After >> =Sheet1!calls
    Select OK

    Viola, this should do it...

    Let me know if I left a hole somewhere in the explanation...
    Last edited by jeffreybrown; 09-02-2012 at 08:30 PM.

  11. #11
    Registered User
    Join Date
    09-01-2012
    Location
    West Midlands, UK
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Macro removes duplicates but Charts blanks - Help needed

    Thanks again Jeff,

    i am going to give this a go tonight and will post back.

    Cheers

    Dave

  12. #12
    Registered User
    Join Date
    09-01-2012
    Location
    West Midlands, UK
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Macro removes duplicates but Charts blanks - Help needed

    seem to be getting this message when trying editing the series and adding this to the after field :

    a formula n this worksheet contains one or more invalid references

    verify that yout formulas contain a valid path, workboook, range name and cell reference.

    have tried it several times but get the same message.

  13. #13
    Registered User
    Join Date
    09-01-2012
    Location
    West Midlands, UK
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Macro removes duplicates but Charts blanks - Help needed

    got it , don;t kow how i messed up firs tfew time but got there now, how do i mark as resolved and star?


    thanks

  14. #14
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Macro removes duplicates but Charts blanks - Help needed

    You are welcome...glad it worked out for you

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    Also, see my sig block

    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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