+ Reply to Thread
Results 1 to 3 of 3

Inserting text in cell based on value in another cell in the same row

  1. #1
    Registered User
    Join Date
    04-19-2013
    Location
    Suffolk, England
    MS-Off Ver
    Excel 2007
    Posts
    2

    Question Inserting text in cell based on value in another cell in the same row

    I'm sure this is relatively simple but here goes:

    I have a weekly accounts payable file which contains various batches of transaction lines. The current file needs additional information to be inserted at various points.

    The length of the file varies each week adn the length of each batch of transactions varies each week. Column A of the file looks like this:

    File header
    Batch header
    Transaction line
    .
    .
    .
    Transaction line
    Batch header
    Transaction line
    .
    .
    .
    Transaction line
    Batch header
    Transaction line
    .
    .
    .
    Transaction line
    EOF
    What I want to to is to read the text in cell An and depending on what it says insert text in the corresponding cell in column B, C etc. Sometimes the text will be just plain text, other times I want to grab a string from another cell in the same row using left,right, mid etc.

    Any help would be greatly appreciated.

    Thanks

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Inserting text in cell based on value in another cell in the same row

    what are you choices of text you need to lookup- would an IF (nested) work ?
    if length you could use a vlookup and if found then add your text

    so all your text maybe in a different sheet and then use if
    assuming the text is in A2 and your lookup text values are on sheet2 A1:A20

    =IF ( ISERROR(VLOOKUP(A2,Sheet2!$A$1:$A$20,1,FALSE)) , what to do if true, what to do if false)

    a sample sheet with what outcome for different scenarios would be useful

  3. #3
    Registered User
    Join Date
    04-19-2013
    Location
    Suffolk, England
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Inserting text in cell based on value in another cell in the same row

    Hi etaf

    thanks for the prompt reply. I think that I wasn't as clear as I might have been. Settimng it down does help clarify the thoiufghts...I attach before and after files.

    What I want to do is:
    - look in column A for ALN and makes a note of the row number
    - perform an action in a different column with that row number
    - change ALN to TL and then loop back to look in column A for the next ALN

    So two key things - recycling the row number into the action, looping until all action completed. Figuring out what the actions are is something that I should be able to cope with.


    What I want to do would look like this (without) punctuation):

    IF A1=ALN D1=[string grabbed from column L, row 1 of before file], E1=[string grabbed from column L, row 1 of before file], etc
    ELSEIF A2=ALN D2=[string grabbed from column L, row 2 of before file], E2=[string grabbed from column L, row 2 of before file], etc
    ELSEIF A3=ALN D3=[string grabbed from column L, row 3 of before file], E3=[string grabbed from column L, row 3 of before file], etc
    .
    .
    until the EOF marker is hit. That could all get a bit long-winded, especially seeing that I can't predict how long the file will be.


    I hope this makes a bit more sense.

    Cheers
    Attached Files Attached Files

+ 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