ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel Formula Question (https://www.excelbanter.com/excel-discussion-misc-queries/192311-excel-formula-question.html)

Chris N

Excel Formula Question
 
Is there a formula which will compare cells between 2 worksheets and then is
they match add from another cell? For example, I have 2 worksheets and each
worksheet has the same user ID. However 2nd worksheet has the user ID more
than once (which is fine). What I want to do is if they are equal then add
the segment ID from another cell from worksheet 1.

Thomas [PBD]

Excel Formula Question
 
Chris,

A little confused, but I can try to help.

Your first sheet will contain the "Segment ID" and the "User ID"? Say:
User Segment
123 1
124 2
125 3
126 4

Your second sheet will contain the "User ID" multiple times, and you want it
to pull the "Segment ID"? Say:
User Segment (Formula)
123 1
123 1
124 2
125 3
125 3
126 4
126 4
126 4


"Chris N" wrote:

Is there a formula which will compare cells between 2 worksheets and then is
they match add from another cell? For example, I have 2 worksheets and each
worksheet has the same user ID. However 2nd worksheet has the user ID more
than once (which is fine). What I want to do is if they are equal then add
the segment ID from another cell from worksheet 1.


JLatham

Excel Formula Question
 
Given the following layout on Sheet1:

A B C
1
2
3 John
4 Jim
5 Wilbur
6 Ralph
7 Jane
8 Mary
9 John

and this setup on Sheet2
A B C
1
2 John ID-Jo
3 Jim ID-Ji
4 Wilbur ID-W
5 Ralph IDR

Then either of these formulas in cell D3 on Sheet2 (or any cell on Sheet2
for that matter) and filled down will work:
Easier (remember in Excel this would not be on 2 lines)
=IF(ISNA(VLOOKUP(C3,Sheet1!A$2:A$5,1,FALSE)),"",C3 & " " &
VLOOKUP(C3,Sheet1!A$2:C$5,3,FALSE))

or more complex but with the same results:
=IF(ISNA(VLOOKUP(C3,Sheet1!A$2:A$5,1,FALSE)),"",C3 & " " &
INDEX(Sheet1!C$2:C$5,MATCH(C3,Sheet1!A$2:A$5,0),1) )

For understanding more of what's going on use Excel Help for the particular
function as VLOOKUP, MATCH, INDEX, or ISNA. Basically the ISNA() portion
says that if it cannot find a match, return a blank cell, otherwise take
what's on a row on Sheet2 and add what's in a cell 3 columns over from column
A of the matched row on Sheet1, and put a space in between the values for
appearance sake.


"Chris N" wrote:

Is there a formula which will compare cells between 2 worksheets and then is
they match add from another cell? For example, I have 2 worksheets and each
worksheet has the same user ID. However 2nd worksheet has the user ID more
than once (which is fine). What I want to do is if they are equal then add
the segment ID from another cell from worksheet 1.



All times are GMT +1. The time now is 03:44 PM.

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