+ Reply to Thread
Results 1 to 2 of 2

IF statement then insert content in a new row

  1. #1
    Registered User
    Join Date
    07-07-2007
    Posts
    1

    IF statement then insert content in a new row

    Hi,

    Have a taken a look through the previous posts, but have not come across anything which sends me in the right direction, so if this has been covered, then a gentle point to the threads concerned would be appreciated, but...

    I have a CSV based spreadsheet, that contains domain name DNS entries, for which I need to add a ton of new lines based on whether an existing line has the desired match information in it and I am pulling my hair our (what I have left of it) trying to work out the best method within Excel to achieve it.

    My excel CSV will have tons of blocks as follows:

    thedomainname.tld{
    |ALLOW_TRANSFER| |xx.xx.xx.xx| || ||
    |NS| |thedomainname.tld.| |ns1.nameserver.tld.| ||
    |NS| |thedomainname.tld.| |ns2.nameserver.tld.| ||
    |CNAME| |ftp.thedomainname.tld.| |cname.anotherdomain.tld.| ||
    |CNAME| |mail.thedomainname.tld.| |cname.anotherdomain2.tld.| ||
    |CNAME| |www.thedomainname.tld.| |cname.anotherdomain3.tld.| ||
    |MX| |thedomainname.tld.| |mx1.mailhost.tld.| |50|
    |MX| |thedomainname.tld.| |mx2.mailhost.tld.| |50|
    }

    and this would be repeated for each domain name....

    What I need to achieve is for some formula to look through each line of the csv file and where it sees -

    |CNAME| |mail.thedomainname.tld.| |cname.anotherdomain2.tld.| ||

    create a new line below it with -

    |CNAME| |smtp.thedomainname.tld.| |cname.anotherdomain4.tld.| ||

    Where all of the resultant cname.anotherdomain4.tld will be the same for all, i.e. different from the 'thedomainname.tld, but all new lines will have the same in, and the domainname itself will differ from block to block.

    In the end the resultant blocks for each domain listed in the spreadsheet would have -

    thedomainname.tld{
    |ALLOW_TRANSFER| |xx.xx.xx.xx| || ||
    |NS| |thedomainname.tld.| |ns1.nameserver.tld.| ||
    |NS| |thedomainname.tld.| |ns2.nameserver.tld.| ||
    |CNAME| |ftp.thedomainname.tld.| |cname.anotherdomain.tld.| ||
    |CNAME| |mail.thedomainname.tld.| |cname.anotherdomain2.tld.| ||
    |CNAME| |www.thedomainname.tld.| |cname.anotherdomain3.tld.| ||
    |CNAME| |smtp.thedomainname.tld.| |cname.anotherdomain4.tld.| ||
    |MX| |thedomainname.tld.| |mx1.mailhost.tld.| |50|
    |MX| |thedomainname.tld.| |mx2.mailhost.tld.| |50|
    }

    To be honest, not sure if formulas are possible for this and a macro is more likely, but again, beyond me, so if anyone has any suggestions, not after the solution (unless someone is able), but suggestions for me to work towards achieveing this, would be much appreciated.

    PS: My excel is an old 2000 version if that makes any difference to the abilities I might be able to achieve with it.

    Thanks for any suggestions, Mac
    Last edited by IanDMac; 07-07-2007 at 01:48 PM. Reason: typo

  2. #2
    Registered User
    Join Date
    07-03-2007
    Location
    Canberra, Australia
    MS-Off Ver
    2010
    Posts
    60
    This may get you started.

    Please Login or Register  to view this content.
    Kerno

+ 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