Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have three columns in excel named 1

Status
Not open for further replies.

EFFEY

Programmer
Jan 30, 2005
2
SA
I have three columns in excel named supervisor,Inspector, wpr
I want to get a result in new cell
If supervisor is yes
Imspector is ywpr is no then its result shoul ne " S-I " or if supervisor is yes inspector is yes wpr is yes then result should be "SIW
 
Just make a truth table to be sure that you have covered all 8 binary cases. You have defined 2 cases.

Here's a start...
[pre]
Supervisor Inspector wpr Result

Y Y Y "SIW"
Y Y N " S-I "
Y N Y
Y N N
...
[/pre]

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein

You Matter...
unless you multiply yourself by the speed of light squared, then...
You Energy!
 
I'm just gonna cut to the chase.

Generally in instances where you have more than 3 cases, like yours, the DATA ought to reside in a TABLE rather than in a formula. Using the technique featured below as a multiple criteria lookup will perform as long as each combination of criteria references one and only one Row in the lookup table.

In regard to any changes that might occur in the future, it's so much easier to change DATA in a table than to figure out how to modify DATA in a FORMULA, which is part of a principle known as maintainability.

So here's my solution:

My Truth/Lookup Table is a Structured Table named Table2...
Tt-truth_table_t73jfr.png


And you can see My Formula...[tt]
I2: =INDEX(D:D,SUMPRODUCT((Table2[Supervisor]=F2)*(Table2[[Inspector ]]=G2)*(Table2[wpr]=H2)*ROW(Table2[Result])))[/tt]

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein

You Matter...
unless you multiply yourself by the speed of light squared, then...
You Energy!
 
 https://files.engineering.com/getfile.aspx?folder=be599ba0-ae85-415c-8693-cfe2dbc8a30a&file=Tt-truth_table.xlsx
Here is another 'interpretation' of EFFEY's requirements...

In cell D2: [tt]
=IF(A2="Y", LEFT($A$1, 1), "") & IF(B2="Y", LEFT($B$1, 1), "") & IF(C2="Y", LEFT($C$1, 1), "")[/tt]

Which is simply - wherever we have Y in the column, give me first letter from row 1 in this column.

Who knows... [ponder]

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top