+ Reply to Thread
Results 1 to 9 of 9

Formula to sort by road name first, then by house number

  1. #1
    Registered User
    Join Date
    10-22-2021
    Location
    Manchester
    MS-Off Ver
    365 for Web Apps
    Posts
    4

    Formula to sort by road name first, then by house number

    Hi all, I've got a bit of an issue with a spreadsheet for work. They want to sort the columns on a report by the road name then by the house number, but the address is recorded as 1 ABC Road for example. I got a formula that mostly works for that, however we have one property that is 150/152 & 154/158 Dave Road and this formula is picking up the & and using that to sort, bringing it to the front of the list. The full addresses are in row 6, and the formula below is in row 7.

    =IF(ISERROR(VALUE(LEFT(B6,1))),B6,MID(B6,FIND(" ",B6)+1,LEN(B6)-FIND(" ",B6)))

    Row 7 then includes just the road names for most of the properties, except '150/152 & 154/158 Dave Road' which shows as '& 154/158 Dave Road'. I'm currently using row 7 to sort.



    The next issue, that the formula doesn't help with, is that they then want each group of properties sorted by number so: 1... 2... 3... 10... 11... not 1... 10... 11... 2... 3... as Excel is doing.

    I've uploaded the same spreadsheet twice - once in .xls once in .xlsx using fake data but giving you an idea of the addresses we need to sort and my current formula in row 7 so you can see what that does as I don't know if I explained it well.

    If anyone has any ideas at all I'll appreciate it so much. It could be one long formula that we'd just copy and paste into each report or even two separate formula to put the road name in one row and the number in the next, then running a sort function on the roan name row followed by the number row. I've personally hit my limit and I'm not even sure how I created that formula in the first place!

    Thanks
    Last edited by hmmm1989; 10-22-2021 at 09:11 AM.

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Formula to sort by road name first, then by house number

    Hi,

    Can you confirm that version of Excel in your profile?

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Formula to sort by road name first, then by house number

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook.

    Administrative Note

    Members will tailor the solutions they offer to the version of Office (Excel) that you have. Please check that your forum profile is up-to-date in this respect. If you aren't sure, in Excel go to File | Account and report what it says below the MS logo at the top of that page. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Registered User
    Join Date
    10-22-2021
    Location
    Manchester
    MS-Off Ver
    365 for Web Apps
    Posts
    4

    Re: Formula to sort by road name first, then by house number

    Hi, we're using Excel For The Web - the free online version. It says Build 16.0.14613.35903 if that helps.

    Hi, thank you for pointing that out to me. I've managed to attached the file now!
    Last edited by AliGW; 10-22-2021 at 08:49 AM. Reason: PLEASE don't quote unnecessarily!

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Formula to sort by road name first, then by house number

    So your version is 365 for Web Apps - yes? Please update to include 365. Thanks.

    The .xls file extension is now ootdated and will not load for some members. Please save the workbook as .xlsx and post it here again. Thanks.

  6. #6
    Registered User
    Join Date
    10-22-2021
    Location
    Manchester
    MS-Off Ver
    365 for Web Apps
    Posts
    4

    Re: Formula to sort by road name first, then by house number

    Thank you for pointing out what I need to include. I'm sorry for not doing it right first time round, so I appreciate your patience with me. Uploaded it in .xlsx as well, I didn't realise .xls wouldn't open for some, I thought everyone could open .xls and only newer version could open .xlsx. I guess you learn something new every day! Thanks.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Formula to sort by road name first, then by house number

    Yes, we can open it, but the forum software can't handle it, meaning that anyone trying to download it will get an error message! Thanks for the .xlsx.

  8. #8
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: Formula to sort by road name first, then by house number

    I would not be hopeful of a generic formula that would work, you would have difficultly explaining in English how to sort by that, its only we recognise the English

    I would suggest an exceptions list
    copy everything that doesn't work into a column and put what you wish it to be next to it
    =IFERROR(VLOOKUP(B6,$N$6:$O$13,2,0),IF(ISERROR(VALUE(LEFT(B6,1))),B6,MID(B6,FIND(" ",B6)+1,LEN(B6)-FIND(" ",B6))))

    where n6 = 150/152 & 154/158 Dave Road
    o6 = dave road

    I cant think of anything else

  9. #9
    Registered User
    Join Date
    10-22-2021
    Location
    Manchester
    MS-Off Ver
    365 for Web Apps
    Posts
    4

    Re: Formula to sort by road name first, then by house number

    Yes, it was hard enough trying to work out how to word what was requested of me in English, let alone try to come up with the formula! I hadn't thought of an exceptions list. That might be the best way to go forward. Thank you for the suggestion and the formula. I'll give it a try when I get a bit of time.
    Last edited by AliGW; 10-22-2021 at 11:38 AM. Reason: PLEASE don't quote unnecessarily!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA code for advance filter take user input for house to house and criteria age >= 60
    By Vsinghgehlot in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-23-2021, 08:37 AM
  2. get company number and address from uk companies house
    By tek9step in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-21-2021, 07:25 AM
  3. Replies: 15
    Last Post: 07-19-2019, 07:04 AM
  4. [SOLVED] insert bonus and house hold number
    By mathanraj76 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-04-2014, 05:56 AM
  5. [SOLVED] Counting the number of Guests to be In House on a certain day.
    By JJohnsey in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-23-2013, 02:37 PM
  6. [SOLVED] Extracting street name and house number from address list
    By Mikey7346 in forum Excel - New Users/Basics
    Replies: 17
    Last Post: 10-26-2012, 07:20 PM
  7. Replies: 9
    Last Post: 09-18-2008, 08:53 AM

Tags for this Thread

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