Power Query; How do I write an IF statement in PQ to mimic these formulas?

DRSteele

Well-known Member
Joined
Mar 31, 2015
Messages
2,640
Office Version
  1. 365
Platform
  1. Windows
Can someone please help me write an IF statement in PQ?

I have the following output (Columns A to G) from a query in a spreadsheet and two formulas (Columns I and J) that depend on that data. I would rather have the formulas in new, calculated columns in PQ but I can't seem to figure out the syntax to write If.Then:Else statements.


Book1
ABCDEFGHIJ
3DateVisitorVisScrHostHstScrResultTotScrVisPtsHstPts
410/7/2015Vancouver Canucks5Calgary Flames1R620
Sheet4
Cell Formulas
RangeFormula
I4=IF(C4>E4,2,IF(OR(C4>E4,F4="S/O",F4="OT"),1,0))
J4=IF(C4OR(C4),1,0))
 
Last edited:

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
=if C4>E4 then 2 else if C4>E4 or F4="S/O" or F4="OT" then 1 else 0

of course - cell references have to be replaced by column names :)
 
Upvote 0
Thank you for the help, ImkeF. That did the trick!
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,331
Members
449,077
Latest member
jmsotelo

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