Link to home
Start Free TrialLog in
Avatar of Alistair_Mair
Alistair_Mair

asked on

EXCEL Lookup a value, compares it against a range and returns a separate value from another cell. (File attached)

If I change the value in CELL "D4" (TABLE 1) the value in CELL "M6" (TABLE 2) should update based on a lookup to the scoring (Table 3) returning the relevant value between C11 to H11.                                    
E.g. If the value in D4 was changed to "4" the value in M6 would change to "2" (D2) based on the associated lookup.                                     
This formula will apply elsewhere to the line 13 and 14 ranges also so should lookup within the specific range listed.
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

can you provide a sample file? it looks confusing if table1, table2 and table3 all in the same worksheet.
Avatar of Alistair_Mair
Alistair_Mair

ASKER

Hi Ryan,

attached file, sorry i thought i had attached it previously. I have put table one and two in worksheet one and table three in worksheet two.
LookupBook2.xlsx
Additionally, the lookup values may be an integer or a fraction and the "score" value returned should be the closest relevant value against the lookup table,
E.g. If the value in D4 was changed to "4" the value in M6 would change to 2 (E3 worksheet 2) based on the assciated lookup .
for the value in D4, is this 4% or 4 ?

so is that you only need to lookup the values for:

Total Cost Reward  
Total Cost Risk

?
Would prefer the entry in D4 was 4% rather than just 4, but really only for display purposes.

Profit
Total Cost Reward
Total Cost Risk

thanks
I guess we may need to change the layout of scoring table so that we can get the values more easily.

User generated image
check the attached sample for illustration.
LookupBook2_b.xlsx
Hi Ryan,

thanks, things are looking up, but while I can change the input value field to include one decimal and it returns the relevant correct values for all entries over 1% (Including fractions) it doesn't for any value under 1% as the input value reverts to a whole decimal percentage i.e. ".9%" reverts to "90%".
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I tried that (Changed the Test Profit Input) to include one decimal point but when i input ".9" it reverts to 90%? Can you send me your revised spreadsheet and i can see if there is a something I'm missing. Thanks.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
as requested, pls see attached.

when your cell already been formatted (Number Formatting) as percentage, you can directly enter the figure directly, and it should be auto-formatted for you the value in percentage.

User generated imageLookupBook2_c.xlsx
@Ryan - still gives 90% when entering 0.9, unfortunately it is standard Excel behaviour.
@Rob,

what i mentioned was this:

Formatting empty cells    If you apply the Percentage format to cells, and then type numbers into those cells, the behavior is different. Numbers equal to and larger than 1 are converted to percentages by default; and numbers smaller than 1 are multiplied by 100 to convert them to percentages. For example, typing 10 or 0.1 both result in 10.00%. (If you don't want to display the two zeros after the decimal point, it's easy to get rid of them, as explained in the following procedure.)

Format numbers as percentages
https://support.office.com/en-us/article/Format-numbers-as-percentages-de49167b-d603-4450-bcaa-31fba6c7b6b4?ui=en-US&rs=en-US&ad=US&fromAR=1
@Ryan - I think I am missing your point. I don't see any mention of formatting empty cells in previous comments. Your comment

42089794

mentions about entering numbers in cells already formatted but that contradicts what the quote from MS says.

Just tested both scenarios:
1) General formatting, enter 0.9 and then format as percentage - result is 90%
2) Format as percentage and then enter 0.9 - same result.

For numbers less than 1 they have to be entered with a percentage symbol or as the true decimal figure.
Thanks guys, I did realise (by attempting a few scenarios) prior to Rob's post that I needed to put a 0 before the decimal point but thank you Rob for taking the time to explain this. Thank you both (Especially Ryan) and I hope you are happy with the point split.   Thanks again Ali