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.
Microsoft ExcelMicrosoft Office

Avatar of undefined
Last Comment
Alistair_Mair

8/22/2022 - Mon
Ryan Chong

can you provide a sample file? it looks confusing if table1, table2 and table3 all in the same worksheet.
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
Alistair_Mair

ASKER
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,
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Ryan Chong

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

?
Alistair_Mair

ASKER
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
Ryan Chong

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

SnapShot.png
check the attached sample for illustration.
LookupBook2_b.xlsx
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Alistair_Mair

ASKER
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
Ryan Chong

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Alistair_Mair

ASKER
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
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Ryan Chong

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.

Untitled.pngLookupBook2_c.xlsx
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Rob Henson

@Ryan - still gives 90% when entering 0.9, unfortunately it is standard Excel behaviour.
Ryan Chong

@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
Rob Henson

@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.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Alistair_Mair

ASKER
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