+ Reply to Thread
Results 1 to 3 of 3

Find data in a column based on the first 2 characters and write the value on a new sheet

  1. #1
    Registered User
    Join Date
    10-28-2014
    Location
    Warren, Michigan
    MS-Off Ver
    2013
    Posts
    6

    Find data in a column based on the first 2 characters and write the value on a new sheet

    Hi,
    I have a spreadsheet with multiple tabs, and i need to search each tab for a value based on the first 2 characters and when found write the value to the cell in a new worksheet tab. Here is the data i am working with....

    example
    B C D E F G H I J K L M N O
    B012 XXB012 3339 241 B112 DFO007 3339 18 B312 GMMR24 3339 241 B412
    B013 DFB012 3339 242 B113 DFL007 3339 19 B313 TDB313 3339 242 B413
    B014 DFB013 3339 243 B114 DFST05 3339 20 B314 TDB314 3339 243 B414
    B015 DFB014 3339 244 B115 DFST06 3339 21 B315 TDB315 3339 244 B415
    B016 DFB015 3339 245 B116 TDB116 1113 22 B316 GMMR42 3339 245 B416
    B017 DFB016 3339 246 B117 TDB117 1113 23 B317 GMMR63 3339 246 B417
    B018 DFB017 3339 247 B118 TDB118 1113 24 B318 GMMR64 3339 247 B418
    B019 DFB018 3339 248 B119 DFSM5A 3339 25 B319 GMMCAT 3339 248 B419
    B01A TDB01A 3339 249 B11A XXB11A 3339 26 B31A GMMR70 3339 249 B41A
    B01B DFB004 3339 250 B11B DFSM5C 3339 27 B31B GMMR30 3339 250 B41B

    this an example of data from one tab, the columns that i want to search are (C, G, L) For any cell that contains TD or XX as the first two characters and write the entire cell on a separate sheet.

    so what i wont the new sheet to look like is this

    XXB012
    TDB01A
    TDB116
    TDB117
    TDB118
    XXB11A
    TDB314
    TDB315

    Can anyone help me?


    Thank you MarkZ.

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Find data in a column based on the first 2 characters and write the value on a new she

    This one beat me up!

    I borrowed shamelessly from many others. The re-dimensioning strategy I got from Lori who answered a near identical challenge posted there.

    The UDF was not included in that challenge. It's called ConcatAll written by tigeravatar.

    There is a formula in Name Manager called Tabs and this is all there is to it.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I limited this to 3 tabs. Sheet4 column A is where the formula is. It must be array entered in A1 and filled down.



    =TRIM(MID(SUBSTITUTE(concatall(IF((LEFT(CELL("contents",IF(1,+INDIRECT("'"&Tabs&"'!"&BASE(MODE.MULT(DECIMAL(ADDRESS(ROW($A$1:$M$10),COLUMN($A$1:$M$10),4),36),DECIMAL(ADDRESS(ROW($A$1:$M$10),COLUMN($A$1:$M$10),4),36)),36)))),2)="XX")+(LEFT(CELL("contents",IF(1,+INDIRECT("'"&Tabs&"'!"&BASE(MODE.MULT(DECIMAL(ADDRESS(ROW($A$1:$M$10),COLUMN($A$1:$M$10),4),36),DECIMAL(ADDRESS(ROW($A$1:$M$10),COLUMN($A$1:$M$10),4),36)),36)))),2)="TD"),CELL("contents",IF(1,+INDIRECT("'"&Tabs&"'!"&BASE(MODE.MULT(DECIMAL(ADDRESS(ROW($A$1:$M$10),COLUMN($A$1:$M$10),4),36),DECIMAL(ADDRESS(ROW($A$1:$M$10),COLUMN($A$1:$M$10),4),36)),36)))),""),";"),";",REPT(" ",256)),(ROWS($1:1)-1)*256+1,256))



    If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.
    Last edited by FlameRetired; 06-22-2016 at 08:27 PM.
    Dave

  3. #3
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Find data in a column based on the first 2 characters and write the value on a new she

    A follow up. This one does not require VBA. It uses the same set-up and re-dimensioning strategy as before.

    It has a helper column in A that assigns index numbers to the qualifiers. The formula must be array entered.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    The output formula in column B must be array entered also.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ 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. How to write macro to find certain data in master sheet and paste into another sheet?
    By travis.cook21 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2015, 09:21 AM
  2. [SOLVED] Find Correct Column based on the name of a different sheet
    By HJHamm in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-19-2015, 04:13 PM
  3. [SOLVED] Based on Column Header find and copy data from one sheet to another
    By Sachy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-31-2014, 10:00 AM
  4. VBA UserForm - Contact sheet; Using a ComboBox array to write data to specific column
    By willmason in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-01-2014, 09:44 AM
  5. [SOLVED] Find duplicates in colA in one sheet and write them in another sheet with row reference
    By Masun in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 03-02-2013, 06:23 PM
  6. write userform data to cell based on column header
    By EMAP in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-13-2012, 08:30 AM
  7. Write new data rows to a new sheet based on data in sheet 1
    By NickPovey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-08-2011, 10:08 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