Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Excel Power Query IF Statement

Hi,

 

I am trying to work on a formula, but it isnt working out.

The column Approved Date has data with Dates and some without Dates (blank)

I would like to put in a formula mentioning , if its blank then the column should return Not Approved

 

if [Approval Date] = null then "Not Approved" else "Approved"

Annotation 2020-09-08 111502.png

 

 

 

 

1 ACCEPTED SOLUTION

Hello @Anonymous 

 

there is definitly a null in your column if the cell is empty. So I checked it against "null" and it works perfectly fine

image.png

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

View solution in original post

11 REPLIES 11
Anonymous
Not applicable

Hi @amitchandak and @Jimmy801 

 

Tried both the methods, the below is the screenshot, I checked the cell, it has only date and the type is selected as date.

 

Capture2.PNG

Hello @Anonymous 

 

last two tries 🙂

if Text.Clean(Text.Trim([Approval Date])) = "" then "Not Approved" else "Approved"

 

if Value.Is([Approval Date],type datetime) = true then "Approved" else "Not approved"

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

Anonymous
Not applicable

@Jimmy801 Tried it not working

 

Anyway to send by email and give it a try

 

Capture3.PNG

Hello @Anonymous 

 

could you upload the file to some sharing site and share the link here, then I can check it

 

Jimmy

Anonymous
Not applicable

Hi @Jimmy801 

 

The file in the below link. I have given the column names with the ones we discussed here.

 

https://drive.google.com/file/d/1wydE7mu23l2VHmvXyIBn5MyWQoW7Thhu/view?usp=sharing

Hello @Anonymous 

 

there is definitly a null in your column if the cell is empty. So I checked it against "null" and it works perfectly fine

image.png

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

Anonymous
Not applicable

I just changed the "" and changed it to null and its working

Jimmy801
Community Champion
Community Champion

Hello @Anonymous 

 

the formula is perfectly fine. However I think your values are not containing null but "" instead

Try to change your formula to:

if [Approval Date] = "" then "Not Approved" else "Approved"

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

@Anonymous ,

 

Try like

if Text.Trim([Approval Date]) = "" then "Not Approved" else "Approved"

 

You can add or [Approval Date] = null

Anonymous
Not applicable

Hi @Jimmy801 , I tried that too even it then returned only Approved

Below picture :

 

Annotation 2020-09-08 114907-2.png

Hello @Anonymous 

 

check your cell content then. I don't know your database, but it could also be that your empty cell contains a space. Try this solution then

if [Approval Date] = " " then "Not Approved" else "Approved"

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors