STW Excel gurus ass...
 

  You don't need to be an 'investor' to invest in Singletrack: 6 days left: 95% of target - Find out more

[Closed] STW Excel gurus assemble (again)

14 Posts
8 Users
0 Reactions
54 Views
Posts: 4961
Free Member
Topic starter
 

Thanks for your help on last weeks question, I've become pretty familiar with vlookup, index and match but I'm now stuck on something I thought would be easy.

Find Value A which is in one of 2 columns (it can be in either but not both so no conflicts),  return the value of the cell 2 cells to the right of the A.

Thanks


 
Posted : 31/10/2018 1:02 pm
Posts: 0
Full Member
 

Are you outsourcing your job to STW? 😀


 
Posted : 31/10/2018 1:09 pm
Posts: 10761
Full Member
 

you can do that with 2 vlookups and  iferror(firstvlookup, secondlvookup)


 
Posted : 31/10/2018 1:11 pm
Posts: 36
Free Member
 

use your MATCH and INDEX skillz with ISERROR and IF to parse both columns

EDIT: the purist beat me to it


 
Posted : 31/10/2018 1:11 pm
Posts: 1294
Free Member
 

Not sure if there's a neater solution but nested if statements aren't too hard to manage over 2 columns. You can use ISNUMBER and SEARCH to check a cell for specific text.

e.g.

IF(ISNUMBER(SEARCH ("A",A2)),C2, IF(ISNUMBER(SEARCH ("A",B2)),D2,""))

Checks A2 for "A", returns C2 if it finds it, if not it checks B2 and returns D2, or leaves blank if it's in neither.

You can also use OFFSET to return relative positions.


 
Posted : 31/10/2018 1:16 pm
Posts: 4961
Free Member
Topic starter
 

Are you outsourcing your job to STW?

I'm an industrial designer who has bitten off more than he can chew!


 
Posted : 31/10/2018 1:19 pm
Posts: 1294
Free Member
 

ps my solution is suitable for ordered data, ie. you know which row you're looking in and just need to return the correct cell depending on whether the value is in column a or b. Otherwise if with lookup as above.


 
Posted : 31/10/2018 1:21 pm
Posts: 4961
Free Member
Topic starter
 

My explanation was slightly wrong as there are about 10 columns the unique value could be in (and any row). Can you use more than 2 vlookups?


 
Posted : 31/10/2018 1:35 pm
Posts: 10761
Full Member
 

You can but IFERROR only works with 2 values, so you'd need to use nested IFs:

IF ( ISERROR (lookup1), if (iserror(lookup 2), if (iserrror(lookup 3), lookup4, lookup3), lookup2), lookup1) or something like that.  I'd suggest trying it with 2 or 3 levels first then expand once you're comfortable.

You might be able to wangle it using an array formula too but that'd be 1) ninja level excel and 2) almost impossible for anyone else to understand


 
Posted : 31/10/2018 1:39 pm
Posts: 12507
Free Member
 

Are the rest of the columns blanks?


 
Posted : 31/10/2018 1:53 pm
Posts: 943
Free Member
 

=IF(ISNUMBER(MATCH(value_A,firstcolumn,0)),INDEX(thirdcolumn,MATCH(value_A,firstcolumn,0)),IF(ISNUMBER(MATCH(value_A,secondcolumn,0)),INDEX(fourthcolumn,MATCH(value_A,secondcolumn,0)),"not found"))


 
Posted : 31/10/2018 1:55 pm
Posts: 1781
Free Member
 

Have PM'd you, OP


 
Posted : 31/10/2018 2:19 pm
Posts: 4961
Free Member
Topic starter
 

I tried your suggestion reggie but couldnt get rid of the errors.

I thought I'd done it with this but, it returns the value 2 columns to the left of the first lookup column regardless of what lookup column contained H15.

=IFERROR(VLOOKUP(H15,' Equipment & Graphics'!$F$8:$H$67,3),IFERROR(VLOOKUP(H15,' Equipment & Graphics'!$X$8:$AA$67,3),IFERROR(VLOOKUP(H15,' Equipment & Graphics'!AB15:AD74,3),"SS")))

It's not that important because the data is not too dynamic.

Thanks all


 
Posted : 31/10/2018 4:11 pm
Posts: 4961
Free Member
Topic starter
 

Sorted it, I'd missed out the false statement in the vlookups


 
Posted : 31/10/2018 4:21 pm
Posts: 10761
Full Member
 

Was just gonna point that out - Excel does some arbitary stuff if your leave that off.  Also make sure the cell references are all absolute (ie. $AB$15:$AD$74) if you're going to copy & paste that.


 
Posted : 31/10/2018 4:23 pm

6 DAYS LEFT
We are currently at 95% of our target!