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
<colgroup><col><col><col></colgroup><tbody>
</tbody>
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
Electricity HH | ABC 1 | 1 |
Electricity HH | ABC 2 | 2 |
Electricity NHH | ABC 287 | 287 |
Electricity NHH | ABC 348 | 348 |
Natural Gas | ABC 526 | 526 |
Natural Gas | ABC 556 | 556 |
Natural Gas | ABC 537 | 537 |
<colgroup><col><col><col></colgroup><tbody>
</tbody>
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!