eveo
eveo

Reputation: 2833

Lookup value in another sheet based on name

I have a file that has:

sheet 1:

Name  Hours Price
-----------------
Name1 12    126.00 
Name2 14    161.00
Name3 8     100.00
Name4 10    135.00

sheet 2:

Name  Rate
---------
Name1 10.5
Name2 11.5
Name3 12.5
Name4 13.5

I want to multiply Hours by the names corresponding rate. So like Name1 = 12 * 10.5 = 126 and so on. Not sure how to do this?

Upvotes: 0

Views: 637

Answers (2)

DatRid
DatRid

Reputation: 1169

I think an rlly easy way if you want to do it over "code" in a excelcell then like this:

=IF(A1=Table2!A1;B1*Table2!B1)

=IF(CELL = CELL; THEN DO; ELSE DO)

If the names can be changing in the order, D Stanleys is better.

Otherwise VBA-Code would be also easy.

Upvotes: 0

D Stanley
D Stanley

Reputation: 152521

One way would be to use VLOOKUP:

(assuming Name is in A1 in both sheets):

The formula in the Price column (C3 through C6) should be

=B3*VLOOKUP(A3,Sheet2!$A$3:$B$6,2,FALSE)

translated:

=  B3   *VLOOKUP(  A3  ,  Sheet2!$A$3:$B$6   ,      2     ,     FALSE   )
={Hours}*VLOOKUP({Name},{Name+Rate in Sheet2},{2nd column},{exact match})

Upvotes: 1

Related Questions