Vlookup with If Statement

S

Shams

Folks,

I have the following scenario:

My lookup table (Sheet 1) contains:
A: Product #
B: Total numbers of lbs.

My main table (Sheet 2) [where the vlookup function resides] has the
following:

A: Product #
B: # of Units

So, let's say, in Column C (in Sheet 2) I am trying to write a vlookup
formula that will look up Product # in Sheet 1 and return the Total number of
lbs. I want to incorporate the additional formula where if it finds the
lookup value then it divides the Total number of lbs. by the # of units.
That's what I am looking for: Lookup A1 in Sheet1 A:B, return B but divide it
by # of units.

Hope this helps. Thanks .

Regards,
Shams.
 
P

Pete_UK

Don't know why you have started a new thread, but this should do what
you want in C1 of Sheet 2:

=VLOOKUP(A1,'Sheet1'!A:B,2,0)/B1

If there is a chance that the Product # in Sheet 2 is not present in
Sheet 1, you might like to amend is as follows:

=IF(ISNA(VLOOKUP(A1,'Sheet1'!A:B,2,0)),"",VLOOKUP(A1,'Sheet1'!A:B,2,0)/B1)

Hope this helps.

Pete
 
S

Shams

Pete,
Thanks for your reply. Your suggestion works just fine. A simple thing to
conceptualize but somehow I closed my mind by trying to focus on an IF
statement.
 
P

Pete_UK

Glad it worked for you - thanks for feeding back.

Pete
Pete,
Thanks for your reply. Your suggestion works just fine. A simple thing to
conceptualize but somehow I closed my mind by trying to focus on an IF
statement.

Shams said:
Folks,

I have the following scenario:

My lookup table (Sheet 1) contains:
A: Product #
B: Total numbers of lbs.

My main table (Sheet 2) [where the vlookup function resides] has the
following:

A: Product #
B: # of Units

So, let's say, in Column C (in Sheet 2) I am trying to write a vlookup
formula that will look up Product # in Sheet 1 and return the Total number of
lbs. I want to incorporate the additional formula where if it finds the
lookup value then it divides the Total number of lbs. by the # of units.
That's what I am looking for: Lookup A1 in Sheet1 A:B, return B but divide it
by # of units.

Hope this helps. Thanks .

Regards,
Shams.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top