Forum Discussion

Mic1979's avatar
Mic1979
Icon for Post Partisan rankPost Partisan
1 year ago
Solved

How to nest If in Functions

Dear all,   I found a very interesting video about  replacement values in a table. Formula E | Electrified, Hankook iON x Formula E Technology (30s) | HankookTire Probably most of you already saw...
  • v-sdhruv's avatar
    1 year ago

    Hi Mic1979 

    You are quite close-
    You need to use nested if...else inside List.Transform and  make sure if is inside each  (i.e., per column list), not outside it. You can modify the syntax to something like this-

    A = Table.ToColumns(#"Removed Columns2"),
    B = Table.ToRows(ReplacementTable_Body_StuffingBox1),

    C = Table.FromColumns(
    List.Transform(
    A,
    each
    if condition1 then
    List.ReplaceMatchingItems(_, B, Comparer.OrdinalIgnoreCase)
    else if condition2 then
    List.ReplaceMatchingItems(_, B, Comparer.Ordinal)
    else
    _
    ),
    Table.ColumnNames(#"Removed Columns2")
    )
    Hope this helps!