Reg. conditional ascii data import from a csv file


Please see the picture of a .csv file, I want to read data only if "SERIES" (i.e. Column 'B') is equal to "EQ", would it be possible using the ASCII import options?

Looking forward to hearing from you soon.

Thanks and Regards


You have sent the same question to support.
Please use only one channel, not two because it takes energy and time to answer duplicates.

There are two possibilities to import only certain set of records.

You should import the WHOLE file, then DELETE records that you don't need.
Or sort the file by given column say in Excel and delete content that you don't need before importing. You already have data in Excel, why don't you just do second point?

AmiBroker features ASCII importer, a fully customizable, flexible data importer that is able
to import about any plain text and/or CSV file stored locally.
This includes data in Excel that can be saved in CSV format.

ASCII importer for proper operation needs you to define file format definition.

You can find detailed description of ASCII importer options and format definitions here

For examples of usage, scroll down to the very end of the above document.

To simplify creation of format definition files there is also Import Wizard that
is described in the manual Import Wizard

need to record macro or copy paste this in excel VBA

 Dim lastRow As Long
    Dim i As Long
    Dim containsEqOrBe As Boolean
    lastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row 'Get last row number
    For i = lastRow To 1 Step -1 'Loop through rows from bottom to top
        containsEqOrBe = False 'Assume row does not contain "eq" or "be"
        If InStr(1, Cells(i, 2), "EQ", vbTextCompare) > 0 Or InStr(1, Cells(i, 2), "BE", vbTextCompare) > 0 Then
            'Check if row contains "eq" or "be" (case-insensitive)
            containsEqOrBe = True
        End If
        If Not containsEqOrBe Then
            Rows(i).Delete 'Delete row if it does not contain "eq" or "be"
        End If
    Next i
    Selection.Replace What:="BE", Replacement:="EQ", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    Selection.Delete Shift:=xlUp
1 Like

Hello Tomasz,

The first reply I got from the support team was not clear to me and it was giving me the impression that it is possible but was not sure how, therefore I posted it in this forum. Thanks for clarifying, I actually wanted to avoid the use of multiple software, hence this quarry.

Best regards

Thanks, Mr. Sandeep, will try this.

Best regards