Stop returning results after the first match.

RockandGrohl

Well-known Member
Joined
Aug 1, 2018
Messages
790
Office Version
  1. 365
Platform
  1. Windows
Hoping this is possible.

In B I have a list of papers

In X there is an IF(AND formula which tells me whether a product type (EU) is suitable for the paper or not.

Where there are multiple papers, I'm seeing multiple EU's - I only want one, however.


BVWXPreferred X Result
Paper NameCountUK?EU?
1
Ashbourne News

<tbody>
</tbody>
1UK
2
Banbury Guardian

<tbody>
</tbody>
2UK
3
Banbury Guardian

<tbody>
</tbody>
2UKEU
4
Barnstaple Chronicle

<tbody>
</tbody>
1UK
5
Barrow Evening Mail - Tue

<tbody>
</tbody>
5UK
6
Barrow Evening Mail - Tue

<tbody>
</tbody>
5UK=IF(AND(V5>1,B5=B4,W5="UK",X4<>"EU"),"EU","")EU
7
Barrow Evening Mail - Wed

<tbody>
</tbody>
5UK
8
Barrow Evening Mail - Wed

<tbody>
</tbody>
5UKEU
9
Barrow Evening Mail - Sat

<tbody>
</tbody>
5UK
10
Bedford Times & Citizen

<tbody>
</tbody>
2UK
11
Bedford Times & Citizen

<tbody>
</tbody>
2UKEUEU

<tbody>
</tbody>

Explanation:

The formula looks to see if the count of papers is more than 1 (if not, "UK") it then looks to see if the paper name is the same as the one below, it checks if W5 is UK which is probably redundant, then it says the cell above the current cell doesn't say EU, then this cell can say EU...

The problem is that where a paper can list 5 times, like Barrow Evening Mail, I get two instances of EU... I only want one however... Any ideas?

Thank you.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
There are multiple issues here, including the fact that adding a weekday to the paper name makes it a unique name, which you don't seem to want. But you might try this formula in X2 and copy down:

=IF(AND(V2>1,W2="UK",COUNTIFS(B$1:B1,LEFT(B2,12)&"*",X$1:X1,"EU")=0),"EU","")
 
Upvote 0
There are multiple issues here, including the fact that adding a weekday to the paper name makes it a unique name, which you don't seem to want. But you might try this formula in X2 and copy down:

=IF(AND(V2>1,W2="UK",COUNTIFS(B$1:B1,LEFT(B2,12)&"*",X$1:X1,"EU")=0),"EU","")


Hi Eric,

I've created a helper column which takes the characters to the left of the dash, that seems to do the trick and allows me to differentiate between different papers. I'll try this after I get settled in today, thanks!
 
Upvote 0
There are multiple issues here, including the fact that adding a weekday to the paper name makes it a unique name, which you don't seem to want. But you might try this formula in X2 and copy down:

=IF(AND(V2>1,W2="UK",COUNTIFS(B$1:B1,LEFT(B2,12)&"*",X$1:X1,"EU")=0),"EU","")


Hi Eric,

I['m having trouble understanding why you locked B1 and X1 for the row?

My data starts on line 3 (so formula must be placed in X3) and I was trying to move things down and then ran across that - was scratching my head.

Also I shouldn't need the (LEFT) side of the formula now as I have a list of unique papers without the Mon, Tue, Wed etc:

Boston Standard
Boston Standard
Bourne Local
Bradford Telegraph & Argus
Bradford Telegraph & Argus
Bradford Telegraph & Argus
Bridlington Free Press
Brighouse Echo
Brighton & Hove Independent
Buckinghamshire Advertiser

<colgroup><col></colgroup><tbody>
</tbody>
 
Upvote 0
There are multiple issues here, including the fact that adding a weekday to the paper name makes it a unique name, which you don't seem to want. But you might try this formula in X2 and copy down:

=IF(AND(V2>1,W2="UK",COUNTIFS(B$1:B1,LEFT(B2,12)&"*",X$1:X1,"EU")=0),"EU","")


=IF(AND(V3>1,W3="UK",COUNTIFS(B$2:B2,B3,X$2:X2,"EU")=0),"EU","")

Aha, I see now. The first lock just pins to the top and allows it to only lookup down the range as far as the formula has progressed. That's very clever!

95% of the way there now, thanks!
 
Upvote 0
Wish I could take credit for that, but I learned that trick from this forum myself a while back. But I'm glad I could pass it on! Good luck with the rest of your workbook!
 
Upvote 0
Wish I could take credit for that, but I learned that trick from this forum myself a while back. But I'm glad I could pass it on! Good luck with the rest of your workbook!

https://www.mrexcel.com/forum/excel...criteria-index-match-large-combo-formula.html

This should be the last one in this saga, then I'm ready to have 8 hours work auto-select itself in about 1 hour!

That was a clever trick indeed - some very intelligent minds on this forum. I bet the developers of Excel get a kick out of the creative ways people work around limitations in the software!
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,935
Members
449,094
Latest member
teemeren

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