ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Comparing two columns and return a third (https://www.excelbanter.com/excel-worksheet-functions/167093-comparing-two-columns-return-third.html)

casedk

Comparing two columns and return a third
 
I'm having some trouble. I'd like to compare two columns and return data
from a third column when True.

For example:

Compare column A to Column C - Rows 1-1000. If A1 appears anywhere in
C1-1000 i want to return the "text" in column D. The row in D is = to the
true value in C.

i.e.

If A1=C47 I want to return the text in D47. Then repeat this for A2-A1000.

Thanks



Pete_UK

Comparing two columns and return a third
 
Something along these lines, I think - put this formula in D1:

=IF(COUNTIF(A$1:A$1000,C1)0,C1,"no match")

and copy down.

This is taking the approach:

"if C1 appears anywhere in A1:A1000, then put C1 into D1"

which I think is logically equivalent to what you said.

Hope this helps.

Pete


On Nov 22, 8:15 pm, casedk wrote:
I'm having some trouble. I'd like to compare two columns and return data
from a third column when True.

For example:

Compare column A to Column C - Rows 1-1000. If A1 appears anywhere in
C1-1000 i want to return the "text" in column D. The row in D is = to the
true value in C.

i.e.

If A1=C47 I want to return the text in D47. Then repeat this for A2-A1000.

Thanks



casedk

Comparing two columns and return a third
 
Pete,

Thanks! The countif took care of my issue with not counting the entire
range!

However, I still have the issue with the True statement. If my countif is
true C1 appears somewhere between A1-A1000 I need to know where that "true"
value was in A1-A1000. Was it A1 or A246 or A934 ....

If C1 appears in A246 then I'd like to put D246 in as my true statement.

In my problem A and D are related:
A=id number
B=description (text)

C=random range of id numbers that I need the description (D).

I want to see if C 1 appears anywhere in A 1-1000 (which your formula does).
Once I find a place where C1=Ax I want to take that description Dx and place
it in E1.

So, I think I may need a second formula or need to modify the true statement.


Thanks for you help.

"Pete_UK" wrote:

Something along these lines, I think - put this formula in D1:

=IF(COUNTIF(A$1:A$1000,C1)0,C1,"no match")

and copy down.

This is taking the approach:

"if C1 appears anywhere in A1:A1000, then put C1 into D1"

which I think is logically equivalent to what you said.

Hope this helps.

Pete


On Nov 22, 8:15 pm, casedk wrote:
I'm having some trouble. I'd like to compare two columns and return data
from a third column when True.

For example:

Compare column A to Column C - Rows 1-1000. If A1 appears anywhere in
C1-1000 i want to return the "text" in column D. The row in D is = to the
true value in C.

i.e.

If A1=C47 I want to return the text in D47. Then repeat this for A2-A1000.

Thanks




Pete_UK

Comparing two columns and return a third
 
You've changed the wording round now from what you originally put. Try
it this way round:

=IF(COUNTIF(C$1:C$1000,A1)0,A1,"no match")

if column A contains the important "text".

Hope this helps.

Pete

On Nov 22, 11:43 pm, casedk wrote:
Pete,

Thanks! The countif took care of my issue with not counting the entire
range!

However, I still have the issue with the True statement. If my countif is
true C1 appears somewhere between A1-A1000 I need to know where that "true"
value was in A1-A1000. Was it A1 or A246 or A934 ....

If C1 appears in A246 then I'd like to put D246 in as my true statement.

In my problem A and D are related:
A=id number
B=description (text)

C=random range of id numbers that I need the description (D).

I want to see if C 1 appears anywhere in A 1-1000 (which your formula does).
Once I find a place where C1=Ax I want to take that description Dx and place
it in E1.

So, I think I may need a second formula or need to modify the true statement.

Thanks for you help.



"Pete_UK" wrote:
Something along these lines, I think - put this formula in D1:


=IF(COUNTIF(A$1:A$1000,C1)0,C1,"no match")


and copy down.


This is taking the approach:


"if C1 appears anywhere in A1:A1000, then put C1 into D1"


which I think is logically equivalent to what you said.


Hope this helps.


Pete


On Nov 22, 8:15 pm, casedk wrote:
I'm having some trouble. I'd like to compare two columns and return data
from a third column when True.


For example:


Compare column A to Column C - Rows 1-1000. If A1 appears anywhere in
C1-1000 i want to return the "text" in column D. The row in D is = to the
true value in C.


i.e.


If A1=C47 I want to return the text in D47. Then repeat this for A2-A1000.


Thanks- Hide quoted text -


- Show quoted text -




All times are GMT +1. The time now is 04:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com