Convert from list to flat CSV with modified data

Convert from list to flat CSV with modified data

By : k3kenan
Date : November 22 2020, 01:01 AM
fixed the issue. Will look into that further I used something like this in another answer: (Edit: Fixed some small errors and updated syntax) Tested Working!
Before Code:
code :
Sub RemoveDups()

Dim CurRow As Long, LastRow As Long, LastCol As Long, DestLast As Long, DestRng As Range, ws As Worksheet

Set ws = ActiveSheet
LastRow = ws.Range("A" & Rows.Count).End(xlUp).Row

For CurRow = LastRow To 3 Step -1
     Set DestRng = ws.Range("B1:B" & CurRow - 1).Find(ws.Range("B" & CurRow).Value, LookIn:=xlValues, LookAt:=xlWhole, SearchDirection:=xlNext)
     If DestRng Is Nothing Then
         'Do Nothing
        DestLast = ws.Cells(DestRng.Row, Columns.Count).End(xlToLeft).Column + 1
        ws.Cells(DestRng.Row, DestLast).Value = ws.Cells(CurRow, 1).Value
        ws.Cells(CurRow, 1).EntireRow.Delete xlShiftUp
     End If
     Next CurRow
ws.Columns("A:A").Insert Shift:=xlToRight
Application.CutCopyMode = False

End Sub

Share : facebook icon twitter icon
Algorithm for converting hierarchical flat data (w/ ParentID) into sorted flat list w/ indentation levels

Algorithm for converting hierarchical flat data (w/ ParentID) into sorted flat list w/ indentation levels

By : user2003497
Date : March 29 2020, 07:55 AM
Does that help Wonsungi's post helped a lot, however that is for a generic graph rather than a tree. So I modified it quite a bit to create an algorithm designed specifically for a tree:
code :
// Data strcutures:
nodeChildren: Dictionary['nodeID'] = List<Children>;
indentLevel: Dictionary['nodeID'] = Integer;
roots: Array of nodes;
sorted: Array of nodes;
nodes: all nodes

// Step #1: Prepare the data structures for building the tree
for each node in nodes
  if node.parentID == NULL
    indentLevel[node] = 0;

// Step #2: Add elements to the sorted list
while roots.IsNotEmpty()
  root = roots.Remove(0);
  rootIndentLevel = indentLevel[root];
  children = nodeChildren[root];
  for each child in children (loop backwards)
    indentLevel[child] = rootIndentLevel + 1
Convert a flat list to list of lists in python

Convert a flat list to list of lists in python

By : jimarezdavid
Date : March 29 2020, 07:55 AM
I wish did fix the issue. One may want to do the contrary of flattening a list of lists, like here: I was wondering how you can convert a flat list into a list of lists.
code :
>>> l = ['a', 'b', 'c', 'd', 'e', 'f']
>>> zip(*[iter(l)]*2)
[('a', 'b'), ('c', 'd'), ('e', 'f')]
>>> l = ['a', 'b', 'c', 'd', 'e', 'f','g']
>>> zip(*[iter(l)]*2)
[('a', 'b'), ('c', 'd'), ('e', 'f')]
How do I convert my flat list to a tree list when trying to bulk import from Excel 2013 to TFS?

How do I convert my flat list to a tree list when trying to bulk import from Excel 2013 to TFS?

By : Volodimir Stefanyuk
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , The Work Item Query you select needs to be a tree-based query. I'm guessing the WI Query you are selecting is a flat-list, that's why those features aren't lighting up in Excel.
Convert flat List<T> to a List<U> using GroupBy to produce rolled up data

Convert flat List<T> to a List<U> using GroupBy to produce rolled up data

By : user3087878
Date : March 29 2020, 07:55 AM
wish of those help UPDATE I also need to keep the Index of first entry of an employee from Listin List for later use. Currently I am using this code modified from Nicolas's answer below , Not much more complex than
code :
public class Employee
  public string EmployeeId    ;
  public DateTime ProjectDate ;
  public string   ProjectCode ;

public class EmployeeRollup
  public string EmployeeId        ;
  public DateTime ProjectDateFrom ;
  public DateTime ProjectDateThru ;
  public string[] ProjectCodes    ;

class Program
  static void Main(string[] args)
    List<Employee>       details = new List<Employee>() ;
    List<EmployeeRollup> summary =
      .GroupBy( e => e.EmployeeId , StringComparer.OrdinalIgnoreCase )
      .Select( g => new EmployeeRollup {
        EmployeeId      = g.Key ,
        ProjectDateFrom = g.Min( e => e.ProjectDate ) ,
        ProjectDateThru = g.Max( e => e.ProjectDate ) ,
        ProjectCodes    = g.Select( e => e.ProjectCode )
                                          .Distinct( StringComparer
                                          .OrdinalIgnoreCase )
                                          .ToArray() ,
    List<Employee>       details = new List<Employee>() ;
    int i = 0 ;
    List<EmployeeRollup> summary =
      .Select( e => new KeyValuePair<int,Employee>(i,e) )
      .GroupBy( kvp => kvp.Value.EmployeeId , StringComparer.OrdinalIgnoreCase )
How to convert a navigation list with depth levels to a parent-child flat list?

How to convert a navigation list with depth levels to a parent-child flat list?

By : robbiego
Date : March 29 2020, 07:55 AM
this one helps. I have these lists in python:
code :
docs_id = ['10','20','21','22','30','31','32','40','41','42','421','422']

text = ['1. Chapter', '2. Chapter', '2.1 Chapter',
        '2.2 Chapter','3. Chapter', '3.1 Chapter','3.2 Chapter',
        '4. Chapter','4.1. Chapter','4.2 Chapter',
        '4.2.1 Chapter','4.2.2 Chapter']

depth= [1, 1, 2, 2, 1, 2, 2, 1, 2, 2, 3, 3]

currentdepth = 1

tree = []

current_doc_id = 0

for i, value in enumerate(text):

    newdepth = depth[i]
    doc_id = docs_id[i]
    title = value

    if newdepth > currentdepth:

        global current_doc_id
        current_doc_id =  docs_id[i-1]
        tree.append([doc_id, title, int(current_doc_id)])

        currentdepth += 1
    elif newdepth == currentdepth:
        tree.append([doc_id, title, int(current_doc_id)])
        tree.append([doc_id, title, int(current_doc_id)])
        while newdepth>currentdepth:
            currentdepth -=1

for i in tree:
Related Posts Related Posts :
  • How to restrict VBA code to a specific worksheet?
  • How to insert column name in the destination table in ssis?
  • Insert text into the background of a cell
  • how do I generate random timestamps in Excel
  • VBScript Opening folder to convert csv to xls
  • Creating a VBA Refresh Macro in Smart View for Oracle
  • Excel Performance issues with countif on multiple rows
  • excel vba http request download data from yahoo finance
  • Excel Vba Loop , not running properly
  • Efficiently hiding / unhiding many (+500) rows in Excel VBA
  • Excel's Find function; Exceptions over values
  • reading data from an excel sheet in perl
  • Using Webservice function in Excel to pull "Next Earnings Date" from Yahoo Finance using Yahoo API
  • Three And (&)'s into an if statement VBA for Excel
  • Certain fractions being calculated in excel 2013
  • Excel formula to find sum of difference
  • countfis or sum if array to work out if given time is between the value of two columns
  • Error in Date Cell in CSV
  • Syntax while trying to include The multi-part identifier [°C] in command text
  • How to find day of the week from known date and month but variable year
  • Modify Marker Transparency with Excel VBA
  • Excel tricky formula
  • Loop Though All UDF Names in Project
  • Searching for function usage in Excel VBA
  • Count how many words from a list appear in a cell
  • Insert Missing Years between 2 years
  • Creating hierarchical sequence in Excel using several functions in formula
  • On Error GoTo statement is still executing although there is no error generated
  • Find last digits with IF
  • Use Excel VBA to find column matches & merge based on the values of two other column
  • PowerPivot not sending Authorization header in Basic Authentication to OData Svc
  • Vlookup not working with text search
  • Paste value from a Userform to a Excel Sheet
  • Excel 2010 Macro to compare two columns for finding the matched value
  • #VALUE error when dealing with long string in UDF in VBA(excel)
  • Refer to a cell in another worksheet by referencing the current sheet's name
  • VBA Excel 2007 : Need to loop copy and loop count number except zero every row above
  • Excel: Conditional probabilities of winning a tiebreaker game
  • How to find groups of individuals who attended multiple events together?
  • Using DateTime when referencing a cell with SUMIFS()
  • VBA Copy & Transpose Data Range
  • Huge excel file... any advice?
  • Looped macro to create a new sheet, rename it, add data from the web, then loop back through until complete
  • copy paste of tab delimited text results in strange formatting in Excel?
  • Excel user defined function: Nth_Occurence
  • Excel ActiveX Button is clickable, but does not work
  • Array Formula Conditional Count
  • YEAR() fitting to WEEKNUM(...,21) in Excel
  • Macro that follows a link and downloads the table into a new sheet
  • How to Concatenate multiple columns if not empty
  • Excel - List all the combinations of two words from one list, in two other columns
  • How do I do my Pentaho Report take the Excel datasource file along to BA/BI Server?
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org