+ Reply to Thread
Results 1 to 8 of 8

Find, return string address in a range of cells with numbers and text

  1. #1
    Spammer
    Join Date
    03-09-2007
    Posts
    8

    Find, return string address in a range of cells with numbers and text

    Please I need a formula to look for a string in a range of cells that can have text, numbers or both, and return the cell address. In the example below I need in B1 to have a formula that will look after this string "Sub-Total by Work Function:" in the range A1:A22. I tried =LEFT and SEARCH functions but did not work. I can't use as search string the whole phrase (Sub-Total by Work Function: Production, Sub-Total by Work Function: Studio) etc because I have a few hundreds Work functions. That's why I need to find the cells that have only the beginning of the string.

    A1 Accnt Serv
    A2 2.00
    A3 3.55
    A4 Editorial
    A5 Sub-Total by employee
    A6 Sub-Total by Work Function: Production
    ....

    A10 Sub-Total by Work Function: Studio

    A22 Sub-Total by Work Function: Managers

    Thank you so much

    Vera

  2. #2
    Spammer
    Join Date
    03-09-2007
    Posts
    8
    I thought that this a tough one only for me but it seems that is a really difficult problem.

    Thank you

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    I assume you didn't get an answer because your post is a bit unclear.

    Can you upload an example with the expected results

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  4. #4
    Spammer
    Join Date
    03-09-2007
    Posts
    8
    I will try to upload a screen shot of the spreadsheet. I made a few changes hoping that will make more sense.

    Thank you.
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    09-09-2005
    Location
    England
    MS-Off Ver
    2007
    Posts
    1,500
    =ADDRESS((SMALL(IF(LEFT(A1:A616,27)="sub-Total by Work Function:",ROW(A1:A616),FALSE), 1 )),COLUMN(A1))

    as an array or if the textstring is in e22
    =ADDRESS((SMALL(IF(LEFT(A1:A616,LEN(E22))=E22,ROW(A1:A616),FALSE), 1 )),COLUMN(A1))

    Regards

    Dav

  6. #6
    Spammer
    Join Date
    03-09-2007
    Posts
    8

    Smile

    Thank you a million times Dav, it's working perfectly.

  7. #7
    Forum Expert
    Join Date
    09-09-2005
    Location
    England
    MS-Off Ver
    2007
    Posts
    1,500
    glad it works, but as VBA Noob said it was not clear what u wanted, i read the post before and could not decide what was required. My usual view is that if people can not be bothered to explain themselves clearly I can not be bothered to think of an answer. if you had included even just the formula in the post extra it would have been enough

    The more effort you put in up front the quicker and more accurate a response you are likely to receive.

    glad it works though and thanks for the feedback, you had done most of the work with your initial formula anyway, the change was only slight.

    Regards

    dav

    oh and i forgot column(a1) is just 1 unless you are copying this formula elsewhere so it could be
    =ADDRESS(SMALL(IF(LEFT(A1:A616,27)="sub-Total by Work Function:",ROW(A1:A616),FALSE), 1 ),1)
    Last edited by Dav; 03-09-2007 at 04:29 PM.

  8. #8
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    But ADDRESS doesn't give the values you want does it? Are you adding INDIRECT to get the value?

    Personally I dislike that approach, ADDRESS is almost always unnecessary in these situations, you could try this formula in G2 copied down as far as necessary....

    =IF(COUNTIF(A$1:A$616,"sub-total*")>=ROWS(G$2:G2),INDEX(C$1:C$616,SMALL(IF( LEFT(A$1:A$616,9)="sub-total",ROW(A$1:A$616)-ROW(A$1)+1),ROWS(G$2:G2))),"")

    confirmed with CTRL+SHIFT+ENTER

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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