Multiple Ifs Replacing NULL in a Column

harishs

Board Regular
Joined
Jul 3, 2016
Messages
50
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi All,

Looking forward to updating below code with Multiple Ifs, criteria based on another column.

Using Power Query, I have connected an Excel Sheet in which I have to update a Column with Excel Formula in Blank Cells:
Code:
=If(And(G2="Confirmed",G2="Probation"),E2+89,If(G2="Probation Extn",E2+179,"CHECK"))

How do I get this formula in Power Query? Below code helped me to get 1 equation but I am struggling to get this for other criteria's.
Code:
let
    Source = Excel.Workbook(File.Conetents("C:\harish.xlsx"), null, ture),
    sheet1_Sheet = Source{[Item="sheet1",Kind="Sheet"]}[Data],
    #"Removed Columns" = Table.RemoveColumns(Source,{"Gender", "Grade"},
    #"ReplaceNulls" = Table.ReplaceValue(#"Removed Columns", null, each if [Probation Status]="Probation" then Date.AddDays([Joining Date], 89) else [Probatoion Date], Replacer.ReplaceValue,{"Probation Status Date}),
in
    ReplaceNulls

hence need your help/suggestion in updating the code below and this should be applied only on Blank Cells in the column.

Regards,
Harish
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
It looks to me like your Excel code won’t work. Cell G2 can never be both “confirmed” and “probation” - not possible. Maybe you mean OR?

i am not sure if Excel Power Query has the “conditional column” button on the Add Column menu. If it is there, that would be your best bet and it is pretty easy to work out. Otherwise you will need to add a new custom column. The syntax is.

= if [column] = “something” then “result” else “alternate”

it is case sensitive.

You can nest if statements inside others. I suggest you use brackets to make it easier to write.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top