ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Vlookup with If Statement (https://www.excelbanter.com/excel-worksheet-functions/114646-vlookup-if-statement.html)

Shams

Vlookup with If Statement
 
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.


Pete_UK

Vlookup with If Statement
 
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

Shams wrote:
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.



Shams

Vlookup with If Statement
 
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" wrote:

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.


Pete_UK

Vlookup with If Statement
 
Glad it worked for you - thanks for feeding back.

Pete

Shams wrote:
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" wrote:

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.




All times are GMT +1. The time now is 08:25 PM.

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