PE New User
New Member
- Joined
- Aug 4, 2014
- Messages
- 21
I am trying to find the last number in a range of cells that include both text and numbers - the range is not fixed and will always change.
I know that if I sort the range with the text included it will not truly sort the numbers, so realise that I need to separate the text from the numbers and have found a way to do this using =MID(J7,FIND(" ",J7)+1,10).
So, I now have the following three columns:
Product Ref MID
[TABLE="width: 334"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]Electricity HH[/TD]
[TD]ABC 1[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Electricity HH[/TD]
[TD]ABC 2[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Electricity NHH[/TD]
[TD]ABC 287[/TD]
[TD]287[/TD]
[/TR]
[TR]
[TD]Electricity NHH[/TD]
[TD]ABC 348[/TD]
[TD]348[/TD]
[/TR]
[TR]
[TD]Natural Gas[/TD]
[TD]ABC 526[/TD]
[TD]526[/TD]
[/TR]
[TR]
[TD]Natural Gas[/TD]
[TD]ABC 556[/TD]
[TD]556[/TD]
[/TR]
[TR]
[TD]Natural Gas[/TD]
[TD]ABC 537[/TD]
[TD]537[/TD]
[/TR]
</tbody>[/TABLE]
The data needs to be sorted firstly by Product and then by Ref, using the MID results.
Following the sort process, I then need to find the highest number that has a Product type of Electricity HH and the output required needs to be the next number.
I also need to do this for the Electricity NHH and Natural Gas, but the output will be in a separate cell for each Product.
I need assistance with trying to work out the best way to achieve this, possibly through use of a macro to insert a column in order to put the MID calculation in, then do the sort in order to find the next available number for each Product.
I hope this makes sense - have tried to put as much information as reading some threads I know that sometimes not enough information is provided on why something is trying to be achieved!
I know that if I sort the range with the text included it will not truly sort the numbers, so realise that I need to separate the text from the numbers and have found a way to do this using =MID(J7,FIND(" ",J7)+1,10).
So, I now have the following three columns:
Product Ref MID
[TABLE="width: 334"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]Electricity HH[/TD]
[TD]ABC 1[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Electricity HH[/TD]
[TD]ABC 2[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Electricity NHH[/TD]
[TD]ABC 287[/TD]
[TD]287[/TD]
[/TR]
[TR]
[TD]Electricity NHH[/TD]
[TD]ABC 348[/TD]
[TD]348[/TD]
[/TR]
[TR]
[TD]Natural Gas[/TD]
[TD]ABC 526[/TD]
[TD]526[/TD]
[/TR]
[TR]
[TD]Natural Gas[/TD]
[TD]ABC 556[/TD]
[TD]556[/TD]
[/TR]
[TR]
[TD]Natural Gas[/TD]
[TD]ABC 537[/TD]
[TD]537[/TD]
[/TR]
</tbody>[/TABLE]
The data needs to be sorted firstly by Product and then by Ref, using the MID results.
Following the sort process, I then need to find the highest number that has a Product type of Electricity HH and the output required needs to be the next number.
I also need to do this for the Electricity NHH and Natural Gas, but the output will be in a separate cell for each Product.
I need assistance with trying to work out the best way to achieve this, possibly through use of a macro to insert a column in order to put the MID calculation in, then do the sort in order to find the next available number for each Product.
I hope this makes sense - have tried to put as much information as reading some threads I know that sometimes not enough information is provided on why something is trying to be achieved!