VBA code required to loop through different sized rows of data and return MAX value










-2















I am currently automating a dashboard creation and I've hit a bit of a roadblock. I need some code that will go through about 7000 rows of data and return the highest value in a certain column for each specific item. The data is copied from a pivot table and so is broken down into row sections, I have attached a mock of what it looks like.



enter image description here



I need the highest value in Column G for each portfolio, and will need to use the portfolio code (e.g. XY12345 - They are always 7 characters) to map that value to the dashboard.



My issue is, each portfolio has a different number of rows for the values, and some have blank cells between them, and therefore I am stumped. I was hoping to use Column J to count the number of rows for each portfolio (as there are no breaks for the portfolios in this column) and then use a loop to loop through each portfolios rows of values, based off the Column J count, and then return the highest row value for each portfolio. Problem is I'm new to VBA and have been teaching myself as I go, and I've yet to use a loop.



Many thanks,



Harry










share|improve this question



















  • 2





    Can you show us the code you have written so far...

    – rohrl77
    Nov 13 '18 at 12:27






  • 1





    Note Application.WorksheetFunction.Max() and rondebruin.nl/win/s9/win005.htm

    – Marcucciboy2
    Nov 13 '18 at 12:29











  • @rohrl77 I haven't written any code yet as I'm not sure where to start as I'm unfamiliar with loops

    – H Smith
    Nov 13 '18 at 13:28











  • I have come up with a solution. Thanks all for your time.

    – H Smith
    Nov 13 '18 at 16:34















-2















I am currently automating a dashboard creation and I've hit a bit of a roadblock. I need some code that will go through about 7000 rows of data and return the highest value in a certain column for each specific item. The data is copied from a pivot table and so is broken down into row sections, I have attached a mock of what it looks like.



enter image description here



I need the highest value in Column G for each portfolio, and will need to use the portfolio code (e.g. XY12345 - They are always 7 characters) to map that value to the dashboard.



My issue is, each portfolio has a different number of rows for the values, and some have blank cells between them, and therefore I am stumped. I was hoping to use Column J to count the number of rows for each portfolio (as there are no breaks for the portfolios in this column) and then use a loop to loop through each portfolios rows of values, based off the Column J count, and then return the highest row value for each portfolio. Problem is I'm new to VBA and have been teaching myself as I go, and I've yet to use a loop.



Many thanks,



Harry










share|improve this question



















  • 2





    Can you show us the code you have written so far...

    – rohrl77
    Nov 13 '18 at 12:27






  • 1





    Note Application.WorksheetFunction.Max() and rondebruin.nl/win/s9/win005.htm

    – Marcucciboy2
    Nov 13 '18 at 12:29











  • @rohrl77 I haven't written any code yet as I'm not sure where to start as I'm unfamiliar with loops

    – H Smith
    Nov 13 '18 at 13:28











  • I have come up with a solution. Thanks all for your time.

    – H Smith
    Nov 13 '18 at 16:34













-2












-2








-2








I am currently automating a dashboard creation and I've hit a bit of a roadblock. I need some code that will go through about 7000 rows of data and return the highest value in a certain column for each specific item. The data is copied from a pivot table and so is broken down into row sections, I have attached a mock of what it looks like.



enter image description here



I need the highest value in Column G for each portfolio, and will need to use the portfolio code (e.g. XY12345 - They are always 7 characters) to map that value to the dashboard.



My issue is, each portfolio has a different number of rows for the values, and some have blank cells between them, and therefore I am stumped. I was hoping to use Column J to count the number of rows for each portfolio (as there are no breaks for the portfolios in this column) and then use a loop to loop through each portfolios rows of values, based off the Column J count, and then return the highest row value for each portfolio. Problem is I'm new to VBA and have been teaching myself as I go, and I've yet to use a loop.



Many thanks,



Harry










share|improve this question
















I am currently automating a dashboard creation and I've hit a bit of a roadblock. I need some code that will go through about 7000 rows of data and return the highest value in a certain column for each specific item. The data is copied from a pivot table and so is broken down into row sections, I have attached a mock of what it looks like.



enter image description here



I need the highest value in Column G for each portfolio, and will need to use the portfolio code (e.g. XY12345 - They are always 7 characters) to map that value to the dashboard.



My issue is, each portfolio has a different number of rows for the values, and some have blank cells between them, and therefore I am stumped. I was hoping to use Column J to count the number of rows for each portfolio (as there are no breaks for the portfolios in this column) and then use a loop to loop through each portfolios rows of values, based off the Column J count, and then return the highest row value for each portfolio. Problem is I'm new to VBA and have been teaching myself as I go, and I've yet to use a loop.



Many thanks,



Harry







excel vba excel-vba loops max






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 12:34









Davesexcel

5,07921936




5,07921936










asked Nov 13 '18 at 12:24









H SmithH Smith

1




1







  • 2





    Can you show us the code you have written so far...

    – rohrl77
    Nov 13 '18 at 12:27






  • 1





    Note Application.WorksheetFunction.Max() and rondebruin.nl/win/s9/win005.htm

    – Marcucciboy2
    Nov 13 '18 at 12:29











  • @rohrl77 I haven't written any code yet as I'm not sure where to start as I'm unfamiliar with loops

    – H Smith
    Nov 13 '18 at 13:28











  • I have come up with a solution. Thanks all for your time.

    – H Smith
    Nov 13 '18 at 16:34












  • 2





    Can you show us the code you have written so far...

    – rohrl77
    Nov 13 '18 at 12:27






  • 1





    Note Application.WorksheetFunction.Max() and rondebruin.nl/win/s9/win005.htm

    – Marcucciboy2
    Nov 13 '18 at 12:29











  • @rohrl77 I haven't written any code yet as I'm not sure where to start as I'm unfamiliar with loops

    – H Smith
    Nov 13 '18 at 13:28











  • I have come up with a solution. Thanks all for your time.

    – H Smith
    Nov 13 '18 at 16:34







2




2





Can you show us the code you have written so far...

– rohrl77
Nov 13 '18 at 12:27





Can you show us the code you have written so far...

– rohrl77
Nov 13 '18 at 12:27




1




1





Note Application.WorksheetFunction.Max() and rondebruin.nl/win/s9/win005.htm

– Marcucciboy2
Nov 13 '18 at 12:29





Note Application.WorksheetFunction.Max() and rondebruin.nl/win/s9/win005.htm

– Marcucciboy2
Nov 13 '18 at 12:29













@rohrl77 I haven't written any code yet as I'm not sure where to start as I'm unfamiliar with loops

– H Smith
Nov 13 '18 at 13:28





@rohrl77 I haven't written any code yet as I'm not sure where to start as I'm unfamiliar with loops

– H Smith
Nov 13 '18 at 13:28













I have come up with a solution. Thanks all for your time.

– H Smith
Nov 13 '18 at 16:34





I have come up with a solution. Thanks all for your time.

– H Smith
Nov 13 '18 at 16:34












1 Answer
1






active

oldest

votes


















3














If I understand correctly, you're looking for the largest value in Column G.



I'm not sure why you think you would need VBA for this.




Get the maximum value of a column



You mentioned that you're concerned about each column not having the same number of cells but that's irrelevant. as SUM ignores blank cells, so just "go long", or - find the maximum of the entire column.




To return the largest number in Column G you could use worksheet formula :



=MAX(G:G)




The only catch is that you can't place that formula anywhere column G or else it would create a circular cell reference (trying to infinitely add a number to itself). let's pit that formula in cell F1 for now (but anywhere besides column G would do fine).




Find the location of a value



Now that you know the largest value, you can determine where it is using a lookup function such as MATCH or VLOOKUP. Like with so many things in Excel, there are several ways to accomplish the same thing. I'll go with MATCH.



Replace the formula from above (in F1) with:




=MATCH(MAX(G:G),G:G,0)




This will return the row number of the first exact match of the maximum value of Column G.




As for the third part of question: returning the code like X12345 where the value exists, will be a little tricky since your data is not organized in a logical tabular style (tabular meaning, "like a table").



Your data is organized for humans to look at, not for machines to easily read and manipulate it. (See: Office Support: Guidelines for organizing and formatting data on a worksheet)



Basically, when organizing data in rows, all relevant information should be on the same row (not a subjective number of rows behind). Also, you have the number combined with other information.



My suggestion for a quick fix:



  1. Right-click the heading of Column C and choose Insert to insert a blank column.

  2. In C2 enter formula: =IF(B2="",C1,LEFT(B2,7))

  3. Copy cell C2

  4. Select cells in column C all the way to the "end" of your data, where ever that is (not the end of the worksheet). For example maybe you would select cells B2:B1000)

  5. Paste the copied cell into all those cells.

Now, you can again modify the formula in F1:




=INDEX(C:C,MATCH(MAX(G:G),G:G,0))




This will return the value from Column C in the same row that the maximum value of Column G is located.



This is known as an INDEX/MATCH formula.



Hopefully this works for you in the interim until you can organize your data more logically. There's lots of related information and tutorials online.






share|improve this answer


















  • 2





    If there's some reason you indeed need to use VBA for this instead of worksheet functions, you can call the worksheet functions from VBA using Application.WorksheetFunction.

    – ashleedawg
    Nov 13 '18 at 13:12











  • Hi Ashleedawg, Thanks for the quick response. The reason I need it in VBA is because it's going into my VBA code that automates the pulling of data from drives and then creates a sheet with a Dashboard Data that has been populated with various data sources by using the portfolio codes. As for organising my data more logically, this is out of my control, as this is the format the data is in. If i were to change it, it would be relatively manual unfortunately, and this would defeat the point of the automation.

    – H Smith
    Nov 13 '18 at 13:23











  • I know how to do the process manually in excel, but as I need it automated, I was looking for a way to do it in VBA. And the main sticking point is working with the difficult data layout, hence why I posted on here. Hope that clarifies things. Thanks

    – H Smith
    Nov 13 '18 at 13:24











  • I also need the largest values in column g for each individual portfolio, not just the whole column.

    – H Smith
    Nov 13 '18 at 13:26










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53280955%2fvba-code-required-to-loop-through-different-sized-rows-of-data-and-return-max-va%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














If I understand correctly, you're looking for the largest value in Column G.



I'm not sure why you think you would need VBA for this.




Get the maximum value of a column



You mentioned that you're concerned about each column not having the same number of cells but that's irrelevant. as SUM ignores blank cells, so just "go long", or - find the maximum of the entire column.




To return the largest number in Column G you could use worksheet formula :



=MAX(G:G)




The only catch is that you can't place that formula anywhere column G or else it would create a circular cell reference (trying to infinitely add a number to itself). let's pit that formula in cell F1 for now (but anywhere besides column G would do fine).




Find the location of a value



Now that you know the largest value, you can determine where it is using a lookup function such as MATCH or VLOOKUP. Like with so many things in Excel, there are several ways to accomplish the same thing. I'll go with MATCH.



Replace the formula from above (in F1) with:




=MATCH(MAX(G:G),G:G,0)




This will return the row number of the first exact match of the maximum value of Column G.




As for the third part of question: returning the code like X12345 where the value exists, will be a little tricky since your data is not organized in a logical tabular style (tabular meaning, "like a table").



Your data is organized for humans to look at, not for machines to easily read and manipulate it. (See: Office Support: Guidelines for organizing and formatting data on a worksheet)



Basically, when organizing data in rows, all relevant information should be on the same row (not a subjective number of rows behind). Also, you have the number combined with other information.



My suggestion for a quick fix:



  1. Right-click the heading of Column C and choose Insert to insert a blank column.

  2. In C2 enter formula: =IF(B2="",C1,LEFT(B2,7))

  3. Copy cell C2

  4. Select cells in column C all the way to the "end" of your data, where ever that is (not the end of the worksheet). For example maybe you would select cells B2:B1000)

  5. Paste the copied cell into all those cells.

Now, you can again modify the formula in F1:




=INDEX(C:C,MATCH(MAX(G:G),G:G,0))




This will return the value from Column C in the same row that the maximum value of Column G is located.



This is known as an INDEX/MATCH formula.



Hopefully this works for you in the interim until you can organize your data more logically. There's lots of related information and tutorials online.






share|improve this answer


















  • 2





    If there's some reason you indeed need to use VBA for this instead of worksheet functions, you can call the worksheet functions from VBA using Application.WorksheetFunction.

    – ashleedawg
    Nov 13 '18 at 13:12











  • Hi Ashleedawg, Thanks for the quick response. The reason I need it in VBA is because it's going into my VBA code that automates the pulling of data from drives and then creates a sheet with a Dashboard Data that has been populated with various data sources by using the portfolio codes. As for organising my data more logically, this is out of my control, as this is the format the data is in. If i were to change it, it would be relatively manual unfortunately, and this would defeat the point of the automation.

    – H Smith
    Nov 13 '18 at 13:23











  • I know how to do the process manually in excel, but as I need it automated, I was looking for a way to do it in VBA. And the main sticking point is working with the difficult data layout, hence why I posted on here. Hope that clarifies things. Thanks

    – H Smith
    Nov 13 '18 at 13:24











  • I also need the largest values in column g for each individual portfolio, not just the whole column.

    – H Smith
    Nov 13 '18 at 13:26















3














If I understand correctly, you're looking for the largest value in Column G.



I'm not sure why you think you would need VBA for this.




Get the maximum value of a column



You mentioned that you're concerned about each column not having the same number of cells but that's irrelevant. as SUM ignores blank cells, so just "go long", or - find the maximum of the entire column.




To return the largest number in Column G you could use worksheet formula :



=MAX(G:G)




The only catch is that you can't place that formula anywhere column G or else it would create a circular cell reference (trying to infinitely add a number to itself). let's pit that formula in cell F1 for now (but anywhere besides column G would do fine).




Find the location of a value



Now that you know the largest value, you can determine where it is using a lookup function such as MATCH or VLOOKUP. Like with so many things in Excel, there are several ways to accomplish the same thing. I'll go with MATCH.



Replace the formula from above (in F1) with:




=MATCH(MAX(G:G),G:G,0)




This will return the row number of the first exact match of the maximum value of Column G.




As for the third part of question: returning the code like X12345 where the value exists, will be a little tricky since your data is not organized in a logical tabular style (tabular meaning, "like a table").



Your data is organized for humans to look at, not for machines to easily read and manipulate it. (See: Office Support: Guidelines for organizing and formatting data on a worksheet)



Basically, when organizing data in rows, all relevant information should be on the same row (not a subjective number of rows behind). Also, you have the number combined with other information.



My suggestion for a quick fix:



  1. Right-click the heading of Column C and choose Insert to insert a blank column.

  2. In C2 enter formula: =IF(B2="",C1,LEFT(B2,7))

  3. Copy cell C2

  4. Select cells in column C all the way to the "end" of your data, where ever that is (not the end of the worksheet). For example maybe you would select cells B2:B1000)

  5. Paste the copied cell into all those cells.

Now, you can again modify the formula in F1:




=INDEX(C:C,MATCH(MAX(G:G),G:G,0))




This will return the value from Column C in the same row that the maximum value of Column G is located.



This is known as an INDEX/MATCH formula.



Hopefully this works for you in the interim until you can organize your data more logically. There's lots of related information and tutorials online.






share|improve this answer


















  • 2





    If there's some reason you indeed need to use VBA for this instead of worksheet functions, you can call the worksheet functions from VBA using Application.WorksheetFunction.

    – ashleedawg
    Nov 13 '18 at 13:12











  • Hi Ashleedawg, Thanks for the quick response. The reason I need it in VBA is because it's going into my VBA code that automates the pulling of data from drives and then creates a sheet with a Dashboard Data that has been populated with various data sources by using the portfolio codes. As for organising my data more logically, this is out of my control, as this is the format the data is in. If i were to change it, it would be relatively manual unfortunately, and this would defeat the point of the automation.

    – H Smith
    Nov 13 '18 at 13:23











  • I know how to do the process manually in excel, but as I need it automated, I was looking for a way to do it in VBA. And the main sticking point is working with the difficult data layout, hence why I posted on here. Hope that clarifies things. Thanks

    – H Smith
    Nov 13 '18 at 13:24











  • I also need the largest values in column g for each individual portfolio, not just the whole column.

    – H Smith
    Nov 13 '18 at 13:26













3












3








3







If I understand correctly, you're looking for the largest value in Column G.



I'm not sure why you think you would need VBA for this.




Get the maximum value of a column



You mentioned that you're concerned about each column not having the same number of cells but that's irrelevant. as SUM ignores blank cells, so just "go long", or - find the maximum of the entire column.




To return the largest number in Column G you could use worksheet formula :



=MAX(G:G)




The only catch is that you can't place that formula anywhere column G or else it would create a circular cell reference (trying to infinitely add a number to itself). let's pit that formula in cell F1 for now (but anywhere besides column G would do fine).




Find the location of a value



Now that you know the largest value, you can determine where it is using a lookup function such as MATCH or VLOOKUP. Like with so many things in Excel, there are several ways to accomplish the same thing. I'll go with MATCH.



Replace the formula from above (in F1) with:




=MATCH(MAX(G:G),G:G,0)




This will return the row number of the first exact match of the maximum value of Column G.




As for the third part of question: returning the code like X12345 where the value exists, will be a little tricky since your data is not organized in a logical tabular style (tabular meaning, "like a table").



Your data is organized for humans to look at, not for machines to easily read and manipulate it. (See: Office Support: Guidelines for organizing and formatting data on a worksheet)



Basically, when organizing data in rows, all relevant information should be on the same row (not a subjective number of rows behind). Also, you have the number combined with other information.



My suggestion for a quick fix:



  1. Right-click the heading of Column C and choose Insert to insert a blank column.

  2. In C2 enter formula: =IF(B2="",C1,LEFT(B2,7))

  3. Copy cell C2

  4. Select cells in column C all the way to the "end" of your data, where ever that is (not the end of the worksheet). For example maybe you would select cells B2:B1000)

  5. Paste the copied cell into all those cells.

Now, you can again modify the formula in F1:




=INDEX(C:C,MATCH(MAX(G:G),G:G,0))




This will return the value from Column C in the same row that the maximum value of Column G is located.



This is known as an INDEX/MATCH formula.



Hopefully this works for you in the interim until you can organize your data more logically. There's lots of related information and tutorials online.






share|improve this answer













If I understand correctly, you're looking for the largest value in Column G.



I'm not sure why you think you would need VBA for this.




Get the maximum value of a column



You mentioned that you're concerned about each column not having the same number of cells but that's irrelevant. as SUM ignores blank cells, so just "go long", or - find the maximum of the entire column.




To return the largest number in Column G you could use worksheet formula :



=MAX(G:G)




The only catch is that you can't place that formula anywhere column G or else it would create a circular cell reference (trying to infinitely add a number to itself). let's pit that formula in cell F1 for now (but anywhere besides column G would do fine).




Find the location of a value



Now that you know the largest value, you can determine where it is using a lookup function such as MATCH or VLOOKUP. Like with so many things in Excel, there are several ways to accomplish the same thing. I'll go with MATCH.



Replace the formula from above (in F1) with:




=MATCH(MAX(G:G),G:G,0)




This will return the row number of the first exact match of the maximum value of Column G.




As for the third part of question: returning the code like X12345 where the value exists, will be a little tricky since your data is not organized in a logical tabular style (tabular meaning, "like a table").



Your data is organized for humans to look at, not for machines to easily read and manipulate it. (See: Office Support: Guidelines for organizing and formatting data on a worksheet)



Basically, when organizing data in rows, all relevant information should be on the same row (not a subjective number of rows behind). Also, you have the number combined with other information.



My suggestion for a quick fix:



  1. Right-click the heading of Column C and choose Insert to insert a blank column.

  2. In C2 enter formula: =IF(B2="",C1,LEFT(B2,7))

  3. Copy cell C2

  4. Select cells in column C all the way to the "end" of your data, where ever that is (not the end of the worksheet). For example maybe you would select cells B2:B1000)

  5. Paste the copied cell into all those cells.

Now, you can again modify the formula in F1:




=INDEX(C:C,MATCH(MAX(G:G),G:G,0))




This will return the value from Column C in the same row that the maximum value of Column G is located.



This is known as an INDEX/MATCH formula.



Hopefully this works for you in the interim until you can organize your data more logically. There's lots of related information and tutorials online.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 13 '18 at 13:10









ashleedawgashleedawg

12.7k42249




12.7k42249







  • 2





    If there's some reason you indeed need to use VBA for this instead of worksheet functions, you can call the worksheet functions from VBA using Application.WorksheetFunction.

    – ashleedawg
    Nov 13 '18 at 13:12











  • Hi Ashleedawg, Thanks for the quick response. The reason I need it in VBA is because it's going into my VBA code that automates the pulling of data from drives and then creates a sheet with a Dashboard Data that has been populated with various data sources by using the portfolio codes. As for organising my data more logically, this is out of my control, as this is the format the data is in. If i were to change it, it would be relatively manual unfortunately, and this would defeat the point of the automation.

    – H Smith
    Nov 13 '18 at 13:23











  • I know how to do the process manually in excel, but as I need it automated, I was looking for a way to do it in VBA. And the main sticking point is working with the difficult data layout, hence why I posted on here. Hope that clarifies things. Thanks

    – H Smith
    Nov 13 '18 at 13:24











  • I also need the largest values in column g for each individual portfolio, not just the whole column.

    – H Smith
    Nov 13 '18 at 13:26












  • 2





    If there's some reason you indeed need to use VBA for this instead of worksheet functions, you can call the worksheet functions from VBA using Application.WorksheetFunction.

    – ashleedawg
    Nov 13 '18 at 13:12











  • Hi Ashleedawg, Thanks for the quick response. The reason I need it in VBA is because it's going into my VBA code that automates the pulling of data from drives and then creates a sheet with a Dashboard Data that has been populated with various data sources by using the portfolio codes. As for organising my data more logically, this is out of my control, as this is the format the data is in. If i were to change it, it would be relatively manual unfortunately, and this would defeat the point of the automation.

    – H Smith
    Nov 13 '18 at 13:23











  • I know how to do the process manually in excel, but as I need it automated, I was looking for a way to do it in VBA. And the main sticking point is working with the difficult data layout, hence why I posted on here. Hope that clarifies things. Thanks

    – H Smith
    Nov 13 '18 at 13:24











  • I also need the largest values in column g for each individual portfolio, not just the whole column.

    – H Smith
    Nov 13 '18 at 13:26







2




2





If there's some reason you indeed need to use VBA for this instead of worksheet functions, you can call the worksheet functions from VBA using Application.WorksheetFunction.

– ashleedawg
Nov 13 '18 at 13:12





If there's some reason you indeed need to use VBA for this instead of worksheet functions, you can call the worksheet functions from VBA using Application.WorksheetFunction.

– ashleedawg
Nov 13 '18 at 13:12













Hi Ashleedawg, Thanks for the quick response. The reason I need it in VBA is because it's going into my VBA code that automates the pulling of data from drives and then creates a sheet with a Dashboard Data that has been populated with various data sources by using the portfolio codes. As for organising my data more logically, this is out of my control, as this is the format the data is in. If i were to change it, it would be relatively manual unfortunately, and this would defeat the point of the automation.

– H Smith
Nov 13 '18 at 13:23





Hi Ashleedawg, Thanks for the quick response. The reason I need it in VBA is because it's going into my VBA code that automates the pulling of data from drives and then creates a sheet with a Dashboard Data that has been populated with various data sources by using the portfolio codes. As for organising my data more logically, this is out of my control, as this is the format the data is in. If i were to change it, it would be relatively manual unfortunately, and this would defeat the point of the automation.

– H Smith
Nov 13 '18 at 13:23













I know how to do the process manually in excel, but as I need it automated, I was looking for a way to do it in VBA. And the main sticking point is working with the difficult data layout, hence why I posted on here. Hope that clarifies things. Thanks

– H Smith
Nov 13 '18 at 13:24





I know how to do the process manually in excel, but as I need it automated, I was looking for a way to do it in VBA. And the main sticking point is working with the difficult data layout, hence why I posted on here. Hope that clarifies things. Thanks

– H Smith
Nov 13 '18 at 13:24













I also need the largest values in column g for each individual portfolio, not just the whole column.

– H Smith
Nov 13 '18 at 13:26





I also need the largest values in column g for each individual portfolio, not just the whole column.

– H Smith
Nov 13 '18 at 13:26

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53280955%2fvba-code-required-to-loop-through-different-sized-rows-of-data-and-return-max-va%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

ReactJS Fetched API data displays live - need Data displayed static

政党