Find the first occurrence in column A and return the value of column B

Hansulet

Board Regular
Joined
Jan 24, 2013
Messages
173
Office Version
  1. 2021
Platform
  1. Windows
I have a data base with 3 columns.

In the first column I have registered the ID of many persons.

I need a formula to find the first occurrence in column A and return in column C the value of column B, only for the first occurence

For example, the result must be as follows:

A B C
111 text 1 text 1
222 text 2 text 2
333 text 3 text 3
444 text 4 text 4
111 text 5 text 1
555 text 6 text 6
222 text 7 text 2
333 text 8 text 3
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Is it possible to update this formula so that, if in column B there is a specific text for the respective ID even if it is not the first appearance, to display it in column C?
If this specific text does not exist in column B for that ID, then column C should display the first occurrence in column B (as in the previous formula)

For example, the result must be as follows:

A B C
111 text 1 aaaaa
222 text 2 bbbb
333 text 3 text 3
444 text 4 text 4
111 aaaaa aaaaa
555 text 6 text 6
222 bbbb bbbb
333 text 8 text 3
 
Upvote 0
111-text1
111-aaaa
==>aaaa (2nd match) (similar to 222)
333- text 3
333-text8
==> text 3 (1st macth)

What is the logic?
 
Upvote 0
I'm sorry, it's my mistake that I expressed myself wrong and I apologize.

In fact, the result should be as follows:

A B C
111 text 1 aaaaa
222 text 2 aaaaa
333 text 3 text 3
444 text 4 text 4
111 aaaaa aaaaa
555 text 6 text 6
222 aaaaa aaaaa
333 text 8 text 3

I mean, my problem imposes 2 conditions:

1. If the text "aaaaa" is not found in column B, then in column C the first occurrence in column B for the respective ID (in column A) must be displayed. This condition is met by your formula, for which I thank you very much.

2. If the column "aaaaa" is found in column B, regardless of whether it is the first occurrence or not, it must be displayed in column C the text "aaaaa" for the respective ID.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,636
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