Returning a value if a given value exists in range

dids86

New Member
Joined
Aug 15, 2024
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi everyone,

New User here.

I’m trying to return a value in excel whereby if the Account Code HT0000 exists within the Transaction number range then Yes is returned against the Transaction Number cell, otherwise No is returned. I’ve included a screenshot below if anyone is able to advise.

1723712102737.png


A follow up query to this, can this be recreated in PowerQuery with DAX?



Thank you for your help
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Try
Excel Formula:
=IF(COUNTIFS($A$2:$A$16,A2,$B$2:$B$16,"HT0000"),"yes","no")
in C1 and pull down
 
Upvote 0
Solution
can this be recreated in PowerQuery with DAX
Power Query doesn't use DAX, so no. ;) You could do it in M code though, or in the data model in DAX.
 
Upvote 0
Power Query doesn't use DAX, so no. ;) You could do it in M code though, or in the data model in DAX.
Thanks, would you know of any way to create a Measure in Powerbi to return the same result or within Power Query Editor?
 
Upvote 0
I'm not sure that a measure would make sense for that, but perhaps a calculated column. You could do it in PQ in various ways. A simple one would be to create a query that just lists Transaction numbers where the code is HT0000 and then merge that with the main query. If the result is null, then the answer is no, if you get a table, the answer is yes. You could also use something like List.Count(List.Select(...)) as an equivalent to COUNTIF.
 
Upvote 0
I'm not sure that a measure would make sense for that, but perhaps a calculated column. You could do it in PQ in various ways. A simple one would be to create a query that just lists Transaction numbers where the code is HT0000 and then merge that with the main query. If the result is null, then the answer is no, if you get a table, the answer is yes. You could also use something like List.Count(List.Select(...)) as an equivalent to COUNTIF.
That's great thank you
 
Upvote 0

Forum statistics

Threads
1,224,166
Messages
6,176,849
Members
452,748
Latest member
harob1223001

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