+ Reply to Thread
Results 1 to 15 of 15

Find sum in other sheet based on name and last used cell in column

  1. #1
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Find sum in other sheet based on name and last used cell in column

    HI I am really not very good to formulaes better to macroes, but i would like some to help me with this.
    I have in Sheet Middle Result All 4 columns from A to D.
    There is a header in column A in this case Denmark. the next form its United Kingdom
    I need to base a sum formula in other sheet on the name column A but from the range in first cell in column D to last used cell
    I need it this way because the range can be variable, and the only i can hold on is the name first cell column A and last used row after this in column D.
    And i can change the name so it takes the next from example United Kingdom

    Formel inside sheet Middle Result 1 example cell B12.


    Please have a look at below test sheet

    Sincerely
    Abjac
    Attached Files Attached Files

  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: Find sum in other sheet based on name and last used cell in column

    Hi

    Im not really sure what you are trying to add, but this will help to add an ID to each row, using a helper column.

    In E1, enter this as a start...
    =A1
    Then in E2, copied down, use this...
    =IF(A2="",E1,A2)

    This will fill in all the country names. If you want to sum items, you can use something like this...
    =SUMPRODUCT((E:E="Denmark")*(B:B="General/CMR - CMR Update"),(D:D))
    (or if you have 2007 then this...=SUMIFS(D:D,E:E,"Denmark",B:B,"General/CMR - CMR Update")
    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 Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Find sum in other sheet based on name and last used cell in column

    Hi FDibbons and thanks for the answer.
    I basically just want to have a formula in cell B12 sheet Middle result 1, which calculate the sum of the numbers in column D
    MIddle Result All.
    The special in it is that the range can be variant. Now it goes from D2:D32. But it could also be shorter or longer.
    Depends of the output.
    So thats why i need the formula to take the range from Column A Denmark to the last used cell in column D.
    Because this is the only thing i have which will be common.
    Next time i get this info. Maybe the range is much shorter.

    I cant add anything in the sheet Middle Result All. Its filled out automatically. So i need the code only to be in cell B12 Middle Result 1. In this sheet i can add a help column, if its nessasary.
    Please try to download my file, will show more i think.
    I tried also just to see your code, but some of it gave an error, could be some about i use exel 2003 i think.

    Please have a look

    Sincerely

    Abjac

  4. #4
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Find sum in other sheet based on name and last used cell in column

    Try this array formula

    =SUM(INDEX('Middle Result All'!D1:INDEX('Middle Result All'!D:D,MATCH(INDEX('Middle Result All'!$A:$A,SMALL(IF('Middle Result All'!$A:$A<>"",ROW('Middle Result All'!A:A)-ROW('Middle Result All'!A1)+1),2)),'Middle Result All'!A:A,0)),0))

    Confirm with Ctrl+Shift+Enter and not just Enter
    Attached Files Attached Files
    Last edited by Ace_XL; 06-16-2013 at 03:25 AM.
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  5. #5
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Find sum in other sheet based on name and last used cell in column

    HI Ace_Xl. I tried it but nothing came out only the code stands in the cell where i put it. Is it possible for you to download my test sheet and try to play with it there and upload that, if you find a solution?

    Sincerely

    Abjac

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

    Re: Find sum in other sheet based on name and last used cell in column

    Why not just fill the data in column A.

    It can be done with the formula FDibbins posted for you.

    It can also be done with an macro.

    After that just make an pivot table of it.

    See the attached file.
    Attached Files Attached Files
    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.

  7. #7
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Find sum in other sheet based on name and last used cell in column

    HI Oeldere. The main reason for this is that it should go automatic.
    There is many other countries to fill out, and for sure it can work, but the sheet i have here is only made by a macro. And from that i put values in to another sheet.
    So thats the main reason. To avoid i have to make allot of changes in this sheet, everytime i get the date there.

    The other i hope can be done.

    So give it a shot if you have time.
    Sincerely

    Abjac

    Also posted here but more based on a macro solution.

    http://www.mrexcel.com/forum/excel-q...ml#post3497367

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

    Re: Find sum in other sheet based on name and last used cell in column

    @abjac,

    Why send an privat message (PM) if you can add this information also on the forum?

    Other people been able to read it also, and take their advantance of it.

    Please Login or Register  to view this content.
    Abjac

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

    Re: Find sum in other sheet based on name and last used cell in column

    Please Login or Register  to view this content.
    1) Which other thing? Please explain.

    2) Did you take a look at my solution (with pivot table) and what is your comment?

    In your first post #1 you write
    Please Login or Register  to view this content.
    3) You've tried to write a macro to fill up the first column and implemented in your other macro?

  10. #10
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Find sum in other sheet based on name and last used cell in column

    HI Oeldere. I just wanted to explain what i need, but dont mind to share i for sure.So sorry for that
    Yes i looked at your solution with the pivot table. It can be used i think.
    But i think i need a macro to fill out the country names.
    And i need the pivot table to be in sheet Sheet Middle Result1 column Z. And i only need the countries and the summary for each country.

    What i mean with that it can change is that the sheet we take these info from.
    It comes from a macro runned over a mastersheet.
    Next time i shall use it the range can be different, with example less for denmark and more for United Kingdom.

    Thats why i need a solution where i consider that this range can change.

    But if it can be done like i explained, i think it will fullfill that,
    I just have to admit i dont know much about pivot tables.
    So if you have time, that solution would be great.

    Sincerely
    Abjac

  11. #11
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Find sum in other sheet based on name and last used cell in column

    I have found out of delete blank rows and also put the names for the countries. With macroes
    So all i need is a formula or better a macro which can count all numbers in column d, where the name in column A i Denmark.
    And the same for United Kingdom
    And other countries which will be there in the real sheet.
    My code is not nice but working.
    Please see i some can help with a macro for the last.
    I would like a macro to display the sumresult for denmark in a certain specified column in Sheet Middle Result1 in cell B12 example.
    Please see if some can help with the rest.

    My code for delete blank rows and fill in country names is like below.

    Sincerely
    Abjac

    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Find sum in other sheet based on name and last used cell in column

    HI I think i will close this thread and make a new one it in vba macro. I think i would more go for a solution with a macro. This that will be the best, so will move this to the VBA section..
    http://www.excelforum.com/excel-prog...html?p=3282708

    Sincerely

    Abjac
    Last edited by abjac; 06-16-2013 at 09:22 AM.

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

    Re: Find sum in other sheet based on name and last used cell in column

    Why should the sum in B12 on the other sheet, what is the reason for that?

    If you use an pivot table you can define it to that cell.

    I don't see the macro to fill up the data in column A, implemented in your used macro.

    Did you made it, or your don't make it?


    4 post for 1 question, it will get confusing for the forummembers.

    http://www.excelforum.com/excel-prog...html?p=3282708
    http://www.mrexcel.com/forum/excel-q...l-other-2.html
    http://www.excelforum.com/excel-form...91#post3282691
    http://www.excelforum.com/excel-prog...15#post3282415

  14. #14
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Find sum in other sheet based on name and last used cell in column

    HI Oeldere.
    If you read my upper post the code to delete blanks and put then names in to the country all the way down, i made that yes-
    But i never heard anything from how to continue with the pivot table. The fact is i dont know about pivot tables so i am a little lost on that to be honest.
    So after not have heard anything, i thought maybe better to try with a macro for the ramining. So yes i made a new thread, because this one is posted under formulas. So i made the new thread under VBA, where i think it belong, which i also explain.
    And the cross posting i off course after the rules post here.
    So yes one posting to say i cross posted.
    And one which was another question, but related yes. That one was solved by Rick Rothstein
    This one where i shifted to VBA catagory, because i though if i want to have a macro, it belong there.
    And the last here in VBA where it belong.
    The fact is i should have this finish for tomorrow, but i dont think it will.So a little pressed with this one.

    Your input lead me in the right direction i think. I have deleted the blank rows and also put the names in with macro in column A.

    And i could use a pivot table, but also i think now it should be possible to do it with a macro.
    Special when the country is in same row as the numbers.

    I would like the pivot table in another sheet yes. Because this is just a middle result. This middle result is created by a macro from a mastersheet.
    And therefor its not so smart to change anything in that sheet.
    The hole idea is of course that i can use this project again and again.
    So i dont have the next time to change codes and formulaes, when the range will change.

    Dont know if i have explained it ok. But i think and also i have uploaded testsheets to look at, so i guess this should be ok.
    Sorry if it have made any confusion.

    Sincerely
    Abjac

  15. #15
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Find sum in other sheet based on name and last used cell in column

    Hi Have been solved in the new thread i made to make a macro. But the solution i got is only with a formula. So is really great
    Will mark this as solved also with reference to the below thread

    http://www.excelforum.com/excel-prog...er-column.html

    Sincerely
    Abjac

+ 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