Forum Discussion

Tom54887's avatar
Tom54887
Copper Contributor
Nov 29, 2018

Formula Help - Please

Hi,

I am struggling.

I am trying to figure out a formula that accomplish the following results:

 

                  Data

                   A             B             Formula Answer

Row 1     4301-01     12                   12

Row 2     4301-02                            12

Row 3     4301-03                            12 

Row 4     4301-04     14                   14

Row 5     4301-05                            14

Row 6     4301-06                            14

5 Replies

  • Tom54887's avatar
    Tom54887
    Copper Contributor

    I am sorry my original case did not reflect exactly what I am trying to accomplish.

    I have a added few more rows of data. I am dealing with an excel table with thousands of records that gets automatically refreshed from a SQL Server Database. 

     

                    Data

                       A             B             Formula Answer

    Row 1     4301-01     12                   12

    Row 2     4301-02                            12

    Row 3     4301-03                            12 

    Row 4     4301-04     14                   14

    Row 5     4301-05                            14

    Row 6     4301-06                            14

    Row 7     4302-01                             

    Row 8     4302-02      5                     5  

    Row 9     4302-03                             5

    • SergeiBaklan's avatar
      SergeiBaklan
      Diamond Contributor

      Hi Tom,

       

      That could be formula

      =IF( RIGHT(A2,2)*1=1, IF(ISBLANK(B2),"",B2), IF(ISBLANK(B2),C1,B2))

      or Power Query which is more preferable if you have thousands of updating records

      let
          Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
          AddThirdColumn = Table.AddColumn(Source, "C", each
              if Text.End([A],2) = "01" then
                  if [B] = null then "" else [B]
              else [B]),
          FillDown = Table.FillDown(AddThirdColumn,{"C"})
      in
          FillDown

      Alternatively you may use PQ to connect to your SQL database and made transformation within that query returning final result.

       

      Both variants are in attached

      • Tom54887's avatar
        Tom54887
        Copper Contributor
        Thank you so much.
        This is my first time coming to this site for help. I have struggled on my own many times for hours. It is so nice to know there is help out there.
        Thanks again.