+ Reply to Thread
Results 1 to 6 of 6

How to get the list where the first number is 2 or 4 from left to right

  1. #1
    Forum Contributor
    Join Date
    09-01-2020
    Location
    bangladesh
    MS-Off Ver
    office 2007
    Posts
    167

    How to get the list where the first number is 2 or 4 from left to right

    When the drop-down menu of cell C1 is selected as 2, the list is as follows (The list is presented below C3)

    20201021.jpg


    When the drop-down menu of cell C1 is selected as 4, the list is as follows (The list is presented below C3)

    20201021-1.jpg
    Attached Files Attached Files
    Last edited by rayhen; 10-21-2020 at 05:27 AM.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: How to get the list where the first number is 2 or 4 from left to right

    Using column B as a helper, put this formula in B2:

    =IF(LEFT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2,"S",""),"L",""),"H",""))=$C$1&"",MAX(B$1:B1)+1,"")

    Copy down to the bottom of your list.

    Then you can use this formula in C3:

    =IFERROR(INDEX(A:A,MATCH(ROWS($1:1),B:B,0)),"")

    and copy this down as far as you need to in order to accommodate the largest sub-list.

    Hope this helps.

    Pete

  3. #3
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: How to get the list where the first number is 2 or 4 from left to right

    Please try at
    D2
    =SUM(--(MOD(SMALL(FIND({1,2,3,4,5,6,7,8,9,0},$A$2:$A$25&1/17)*10+{1,2,3,4,5,6,7,8,9,0}+ROW($A$2:$A$25)*10^6,(ROW($A$2:$A$25)-ROW($A$2))*10+1),10)=$C$1))

    C3
    =IF(ROWS(C$3:C3)>$D$1,"",INDEX(A:A,SMALL(IF(MOD(SMALL(FIND({1,2,3,4,5,6,7,8,9,0},$A$2:$A$25&1/17)*10+{1,2,3,4,5,6,7,8,9,0}+ROW($A$2:$A$25)*10^6,(ROW($A$2:$A$25)-ROW($A$2))*10+1),10)=$C$1,ROW($A$2:$A$25)),ROWS(C$3:C3))))

    Ctrl+Shift+Enter
    Attached Files Attached Files

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: How to get the list where the first number is 2 or 4 from left to right

    Incidentally, if you are really using Excel 2003, as your profile states, then you won't be able to use the IFERROR function. You will have to use this in C3:

    =IF(COUNTIF(B:B,ROWS($1:1)),INDEX(A:A,MATCH(ROWS($1:1),B:B,0)),"")

    then copy down.

    If you have moved on from version 2003, please update your profile to show this by tapping on the User CP button at the top of the screen.

    Pete

  5. #5
    Forum Contributor
    Join Date
    09-01-2020
    Location
    bangladesh
    MS-Off Ver
    office 2007
    Posts
    167

    Re: How to get the list where the first number is 2 or 4 from left to right

    Excellent solution. Thank you both, thank you very much for the solution.

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: How to get the list where the first number is 2 or 4 from left to right

    You're welcome - thanks for the rep, and for marking the thread as Solved.

    Pete

+ 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. [SOLVED] How to add left and right quote for list of serial number
    By MAHMUZ in forum Excel General
    Replies: 6
    Last Post: 10-02-2019, 12:47 PM
  2. Assign a number to on the left row to unique entries on a list
    By Osanties in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-23-2017, 04:24 PM
  3. macro to add the number to the left
    By max_max in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-04-2016, 05:33 PM
  4. [SOLVED] Draw random names from list and then remove, carry on till no names left in list
    By dave1983 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-26-2014, 12:14 PM
  5. [SOLVED] LEFT find any number
    By mellopete in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-09-2012, 02:52 PM
  6. Sumproduct(LEFT(Number;1=6)).....
    By a94andwi in forum Excel General
    Replies: 4
    Last Post: 03-07-2007, 05:53 AM
  7. Replies: 4
    Last Post: 01-02-2007, 07:50 AM

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