Forum Message

Topic: Re:Re:Excel 2010 programming - can anyone help on here?
Posted by: Richard Jennings
Date/Time: 04/10/14 18:16:00

Yes, LOOKUP and VLOOKUP will do what you want without resorting to Visual Basic coding.

Let's assume the first table (the one showing the codes for different categories) is in B2:E4, the second table listing the phrase for each code is in H2:I8, and the results table is in B10:C12.  (These are all on the same sheet.)

The first logical stage is to obtain the codes for the target category.  The code for Entry 1 is =LOOKUP(B$10,C$2:E$2,C3:E3).  This basically says look in row 2 for the category text that's in B10, and give me the corresponding item in row 3.

That will give you the codes but what you want are the phrases.  So you build that LOOKUP formula into a VLOOKUP function like this:

=VLOOKUP(LOOKUP(B$10,C$2:E$2,C3:E3),H3:I8,2,FALSE)

The LOOKUP function specifies the code to look up in the second table H3:I8, and the "2" says use the second column of that table to produce the phrase.  The "FALSE" is to ensure that it will object if there's a wrong or missing entry in the table.

That formula can be copied down to the other Entry lines unchanged.


Entire Thread
TopicDate PostedPosted By
Excel 2010 programming - can anyone help on here?04/10/14 09:06:00 George Turner
   Re:Excel 2010 programming - can anyone help on here?04/10/14 10:09:00 Richard Jennings
      Re:Re:Excel 2010 programming - can anyone help on here?04/10/14 11:12:00 Andy Brown
         Re:Re:Re:Excel 2010 programming - can anyone help on here?04/10/14 12:31:00 Will Watson
            Excel 2010 programming - can anyone help on here?04/10/14 14:43:00 George Turner
               Re:Excel 2010 programming - can anyone help on here?04/10/14 14:57:00 Will Watson
                  Re:Re:Excel 2010 programming - can anyone help on here?04/10/14 17:51:00 George Turner
                     Re:Re:Re:Excel 2010 programming - can anyone help on here?04/10/14 18:10:00 Will Watson
                  Re:Re:Excel 2010 programming - can anyone help on here?04/10/14 18:16:00 Richard Jennings
                     Re:Re:Re:Excel 2010 programming - can anyone help on here?04/10/14 18:29:00 Richard Jennings

Forum Home