+ Reply to Thread
Results 1 to 20 of 20

Searching a column for text (any text) and if it's there place it in a specific cell

  1. #1
    Registered User
    Join Date
    04-03-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    9

    Searching a column for text (any text) and if it's there place it in a specific cell

    Hi guys, I've made a trading based spreadsheet that changes every day. Basically when a stock shows certain characteristics it will appear in a certain cell in a column (otherwise the cell will be ""). It will usually be the only peice of text in that column, but maybe one other if they are exactly equal values (It's % change from previous close, so a tie is possible sometimes). Usually should be the only text in that column though. I'm wondering if it's possible to search thru that 99% empty column (or "" to be precise) and put the piece of text if it exists in a desired cell at the top of the spreadsheet. It's so I don't have to keep scrolling around to find the output of my spreadsheet. Hopefully I can organise it a bit (lot) better.

    Craig.

    P.S. I've found this forum very helpful for most of my dramas. Really good stuff.
    Last edited by Gherkin; 04-10-2013 at 06:28 PM.

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Searching a column for text (any text) and if it's there place it in a specific cell

    Hi Gherkin,

    welcome to the forum.
    Can you share a sample workbook along with your expected output. Thanks.


    Regards,
    DILIPandey
    <click on below * if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  3. #3
    Registered User
    Join Date
    04-03-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Searching a column for text (any text) and if it's there place it in a specific cell

    How do i do that?

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Searching a column for text (any text) and if it's there place it in a specific cell

    Once you are in reply window, click on "go advanced" button (located on bottom right side) and you'll see a paper clip icon, click that and follow the wizard. Thanks.


    Regards,
    DILIPandey
    <click on below * if this helps>

  5. #5
    Registered User
    Join Date
    04-03-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Searching a column for text (any text) and if it's there place it in a specific cell

    Here is an example of the problem. I'm trying to get any text that will appear in the column to be written in another cell, and the text can be any one of 100 stocks names and it will change every day.
    Attached Files Attached Files

  6. #6
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Searching a column for text (any text) and if it's there place it in a specific cell

    In cell D4, you mentioned "any text in V column", so does that mean any text from v column would be shown here ?


    Can you explain using an example ? thanks.


    Regards,
    DILIPandey
    <click on below * if this helps>

  7. #7
    Registered User
    Join Date
    04-03-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Searching a column for text (any text) and if it's there place it in a specific cell

    I'm not sure if excel can do what I'm after but you're right in your comment: Any text that appears in column V would then be written in cell D4. Also any text that appeared anywhere within the next column (W) would then be copied to cell D6, and any text that appears anywhere in the next column over X would then be copied in cell D8. I'm after some way of checking if there is any text (and it can be any one of over 100 stock codes) appears anywhere within a range in a column, and whichever code appears in that range will then be copied to another location in the spreadsheet so I don't have to scroll around searching for it. Is this even possible in excel? I really want the summary to be up the top so my spreadsheet is usable in real time.

  8. #8
    Registered User
    Join Date
    04-03-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Searching a column for text (any text) and if it's there place it in a specific cell

    Oh wow, I have accidentally moved the columns I'm referring to in my example. No wonder I confused you. I'm very sorry, instread of column V in my example spreadsheet read column "O" (the text that appears in this coklumn is "AIO") and the next column over (column P) has "BPT" written in it further down. It's these codes I'm trying to pick out of the column to display elsewhere.

  9. #9
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Searching a column for text (any text) and if it's there place it in a specific cell

    Okay.. np.
    Now, can you upload a revised workbook along with your expected output. thanks.


    Regards,
    DILIPandey
    <click on below * if this helps>

  10. #10
    Registered User
    Join Date
    04-03-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Searching a column for text (any text) and if it's there place it in a specific cell

    Example for forum2.xls


    Ok, it's now accurate. Basically the stock codes will appear somewhere in an othewrwise blank column and if possible I'm trying to pick up the text (no matter where in the column it appears) and copy it into another cell.

  11. #11
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Searching a column for text (any text) and if it's there place it in a specific cell

    okay.. I guess you need any text from columns O,P,Q,R,S,T as per your remarks in left side of sheet.

    Now, I believe you do not need any text from O5:T5 as these appears as headings.. correct ?

    Regards,
    DILIPandey
    <click on below * if this helps>

  12. #12
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Searching a column for text (any text) and if it's there place it in a specific cell

    Okay.. see the attached file :-

    Example for forum2.xls



    Regards,
    DILIPandey
    <click on below * if this helps>

  13. #13
    Registered User
    Join Date
    04-03-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Searching a column for text (any text) and if it's there place it in a specific cell

    thanks you for being so patient, you are correct about getting any text from those columns except the headings. The new formula doesn't work though. It justs shows #NAME? in the cells D4 D6 and D8 as well as the ones in G4 G6 and G8. I don't understand the RANDBETWEEN(1,22) formula. What is it meant to do? Doesn't it generate a random number? I'm trying to find any text in a column and place it somewhere else in the spreadsheet.

  14. #14
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Searching a column for text (any text) and if it's there place it in a specific cell

    Okay..

    Did you found any #NAME in my above attachment ?
    Randbetween function is just giving random numbers between 1 and 22 which is used by offset function to pick values in the same column. Suggest you to look into Offset function to understand the logic. Thanks.


    Regards,
    DILIPandey
    <click on below * if this helps>

  15. #15
    Registered User
    Join Date
    04-03-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Searching a column for text (any text) and if it's there place it in a specific cell

    I did look into that offset function. I didn't understand how you can reference a specific cell to offset when the cell that has the text in it changes every time I run the spreadsheet. I think that's the crux of the problem. If I knew which cell would have the text it would be easy. Is there some combination of the offset function and the random number generation that I'm missing? It doesn't work in the attached spreadsheet you sent either. It definitely has the #NAME? in your attachment. Does it work in yours? I am grateful for your help.

  16. #16
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Searching a column for text (any text) and if it's there place it in a specific cell

    I did not see any #NAME error in my workbook.

    since you need "any text" from the column, hence I used RandBetween function and since the data on the left side of these columns are 22 rows long, I used randbetween(1,22) which will generate any number between 1 and 22 e.g., suppose it generates 5, offset function will get value of 5th cell from the heading for that column and similarly for all columns... I see this quite simple.

    Open my workbook and keep pressing F9 key and you'll see that the formulas will keep on picking random values from respective columns.

    Offset function and randbetween function both works in Excel2003 hence I am not sure why you are getting #Name error.


    Regards,
    DILIPandey
    <click on below * if this helps>

  17. #17
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Searching a column for text (any text) and if it's there place it in a specific cell

    IN D4
    =LOOKUP(2, 1/($O$6:$O$27<>""), $O$6:$O$27)

    So you can understand and duplicate it.
    Lookup is looking for the first instance of 2, in the array 1/(O6:O27<>"")
    O6:O27 is going to return False or 0 when the cell is blank and True or 1 when it's True
    So in your example, we get this array
    {1/0, 1/0, 1/0, 1/1, 1/0....} 1/0 results in an error which lookup ignores.
    The lookup will never find a 2 so it will return the last value (ignoring errors) that it finds which will be the last cell that has text in it.
    Does that help?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  18. #18
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Searching a column for text (any text) and if it's there place it in a specific cell

    FYI, You are probably getting #NAME error because in Excel 2003, you need to enable the "Analysis Toolpak Addin" to use RANDBETWEEN. I am not sure that Dili's solution will work for you though.
    Last edited by ChemistB; 04-09-2013 at 09:19 AM.

  19. #19
    Registered User
    Join Date
    04-03-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Searching a column for text (any text) and if it's there place it in a specific cell

    Holy moley ChemistB you are a champion! I've been stuck on this for 2 weeks. Thank you so much. It works perfectly and it helps greatly! Thank you.
    Thank you Dili as well for your generous time and help.

  20. #20
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Searching a column for text (any text) and if it's there place it in a specific cell

    Thanks ChemistB

    Gherkin, please mark this thread as [SOLVED].. thx


    Regards,
    DILIPandey
    <click on below * if this helps>

+ 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