Equating input in one column to values in the next column

PP

Board Regular
Joined
Sep 30, 2006
Messages
139
In column H any one of the following values could be inputted:

am
pm
am pm
1
2
3
4
5
6

as they are inputted a value should appear in column I based on the following 'scoring' system:

am=1, pm=1, am pm =2, 1=2, 2=4, 3=6, 4=8, 5=10, 6=10

I tried setting up a VLookup table in another sheet called punishment table to hold these values, the first column starting at A2 and second column starts in B2.


1 2
2 4
3 6
4 8
5 10
6 10
am 1
am pm 2
pm 1

Am I going about this in the right way? Can't seem to get it to return the right value in column I. :(
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Hi,

use LOOKUP instead of VLOOKUP
   A     B  
 2 1     2  
 3 2     4  
 4 3     6  
 5 4     8  
 6 5     10 
 7 6     10 
 8 am    1  
 9 am pm 2  
10 pm    1  

table

[Table-It] version 06 by Erik Van Geit
  H  I  
2 2  4  
3 4  8  
4 6  10 
5 am 1  

output

[Table-It] version 06 by Erik Van Geit
Code:
RANGE FORMULA (1st cell)
I2:I5 =LOOKUP(H2,table!A2:A10,table!B2:B10)

[Table-It] version 06 by Erik Van Geit
kind regards,
Erik
 

PP

Board Regular
Joined
Sep 30, 2006
Messages
139
Tried this:

=VLOOKUP('Punishment Table'!A2:A10,'Punishment Table'!A2:B10,'Punishment Table'!B2:B10,FALSE)

when H8=am and it returned am instead of 1
 

PP

Board Regular
Joined
Sep 30, 2006
Messages
139

ADVERTISEMENT

Sorry Erik - didn't notice you had posted on the thread. I will try your solution and feedback
 

PP

Board Regular
Joined
Sep 30, 2006
Messages
139
Using your solution I tried to modify it as my table was set up in a sheet called punishment table, that's why it's taken me so long to respond:

=LOOKUP(H8,'Punishment Table'!A2:A10),'Punishment Table'!B2:'2.10.06'!)

but this returns an error
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
why do you have
'2.10.06'
in your formula ?
this cannot work: you need a cellreference (or a named range)
 

Forum statistics

Threads
1,136,349
Messages
5,675,243
Members
419,556
Latest member
rdecker12

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top