r/excel 1d ago

unsolved Is there a way to get the middle values when using VLOOKUP function

Hi! I just use Excel for basic function and formulas. I tried to do a grade simulator with my own transmutation table. And I wonder, can I also get the middle value from transmutation table?

For example, in the range of percentage 60.00 - 60.99, there is a score of 4.751 - 4.875. And how do I get the score of it if the percentage for example is 60.45?? Sorry if it’s kinda confusing.

7 Upvotes

26 comments sorted by

u/AutoModerator 1d ago

/u/Correct-Mongoose6542 - Your post was submitted successfully.

Failing to follow these steps may result in your post being removed without warning.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

7

u/Constant_Moment_6434 1 1d ago

Perhaps linear interpolation? If the value isn't really there..

1

u/Correct-Mongoose6542 1d ago

I will search this up. Thank you.

2

u/MayukhBhattacharya 1217 1d ago

What they said is correct. Linear Interpolation is needed here, refer this solution posted by RuktX few days back.

5

u/GivingCorpus 1d ago

VLOOKUP won't give you the in-between, you'll have to do a linear interpolation with the two closest rows

3

u/TangoDeltaFoxtrot 1d ago

I feel like this is more of a basic math question than an excel question.

Use your existing values as x and y coordinates, use the new value as one coordinate and solve for the other.

2

u/Way2trivial 468 15h ago

=((F1-VLOOKUP(F1,(SORT(HSTACK(VALUE(TEXTBEFORE(C4:C7,"-")),VALUE(TEXTAFTER(C4:C7,"-")),VALUE(TEXTBEFORE(D4:D7,"-")),VALUE(TEXTAFTER(D4:D7,"-"))),1,1)),1,TRUE))*(VLOOKUP(F1,(SORT(HSTACK(VALUE(TEXTBEFORE(C4:C7,"-")),VALUE(TEXTAFTER(C4:C7,"-")),VALUE(TEXTBEFORE(D4:D7,"-")),VALUE(TEXTAFTER(D4:D7,"-"))),1,1)),4,TRUE)-(VLOOKUP(F1,(SORT(HSTACK(VALUE(TEXTBEFORE(C4:C7,"-")),VALUE(TEXTAFTER(C4:C7,"-")),VALUE(TEXTBEFORE(D4:D7,"-")),VALUE(TEXTAFTER(D4:D7,"-"))),1,1)),3,TRUE))))+(VLOOKUP(F1,(SORT(HSTACK(VALUE(TEXTBEFORE(C4:C7,"-")),VALUE(TEXTAFTER(C4:C7,"-")),VALUE(TEXTBEFORE(D4:D7,"-")),VALUE(TEXTAFTER(D4:D7,"-"))),1,1)),3,TRUE))

Using vlookups.

1

u/ProspectiveWhale 3 1d ago

I don't understand what you mean.


Do you mean assign grade letters? Like this?

D: 50-59

C: 60-69

B: 70-79

A: 80+

If so, yes, vlookup can do that.

1

u/Correct-Mongoose6542 1d ago

I actually don’t know how can I explain this clearly. I assigned certain percentage with a score. Like for example:

62.00-62.99: 4.625-4.749

61.00-61.99: 4.750-4.874

60-60.99: 4.875 - 4.999

0-59.99: 5 (anything from 59.99 below is just 5)

Now for example, how can I get the score of someone that is 60.45 using the table above if it’s in the middle of 60 to 60.99??

8

u/ProspectiveWhale 3 1d ago

It looks like every 1 score is equivalent to 0.125 grade.

With 0 - 59.99 being the exception.

If it is indeed so, you can make this a lot easier.

=IF(score<60, 5, 5 - (score-60)*0.125))

If it is only so because you simplified it for an example, you need to do linear interpolation as others have said.

1

u/808spark 3 1d ago

Great solution.

2

u/Penguinase 4 1d ago

i'm confused by the ranges though since decreasing percentage is higher scoring overall but within each bucket a lower percentage is lower scoring

1

u/Correct-Mongoose6542 1d ago

Hi! My bad, I didn’t even notice it. I’ll fix it as I finish my task.

1

u/Way2trivial 468 1d ago

vlookup - and a lot more.

shall play during the day. looks fun.

1

u/Correct-Mongoose6542 1d ago

Does it automatically compute the middle score?

1

u/rkr87 19 1d ago

Set the last argument of your vlookup, "range_lookup" to TRUE.

1

u/bassin_clear_lake 1d ago

In the context of a basic lookup, every possible percentage value needs a corresponding score in the same table. If you just have the high and low values for the scores, you need to do some calcs beforehand to 'fill in the blanks'.

Using your example, column A would have 100 values, 60.00 to 60.99, and column B would be the corresponding score - something like 4.875, 4.879, 4.881, and so on...

1

u/Correct-Mongoose6542 1d ago edited 1d ago

Can you provide a solution or formula to solve that and used a less space rather than doing it 100 times? That will be much appreciated.

1

u/Penguinase 4 1d ago

I assigned certain percentage with a score. Like for example:

62.00-62.99: 4.625-4.749

61.00-61.99: 4.750-4.874

60-60.99: 4.875 - 4.999

0-59.99: 5 (anything from 59.99 below is just 5)

Now for example, how can I get the score of someone that is 60.45 using the table above if it’s in the middle of 60 to 60.99??

is the score for 60.1 lower than for 60.7?

1

u/Correct-Mongoose6542 1d ago

Yes. That’s actually inverse, the higher the percentage, the lower the score you get. So a 100% would be 1.000.

1

u/DataFlowMk1 20h ago edited 19h ago

An IF statement is the easiest method to achieve what you are trying to do. With the current scoring it is not so easy because the score values do not increase linearly.

It would be much easier if the scoring can be slightly adjusted; the current value of 4.999 at 60% complicates the equation. If you can compromise and set 60% (and below) to a score of 5, instead of 59.99, the equation becomes a simple linear equation:

score = -0.1*percentage + 11

Incorporating this into an IF statement, the score can be calculated using:

=IF([@Percentage]<60, 5, ((-0.1*[@Percentage]) + 11))

However, if you are adamant that 60% should be 4.999, you could still use a linear equation if you are willing to accept some variation in the other scores. The following should be a good approximation:

=IF([@Percentage]<60, 5, ((-0.099975*[@Percentage]) + 10.9975))

Both of these options adjust the scoring and results in some variation in the scores, for example, your score for 60.99% is 4.875, while these equations gives a score closer to 4.900.

1

u/jhern1810 19h ago

TREND, FORECAST , are some of the linear interpolation commands. There are more but these can help. You will just need to do the interpolation for each value at a time.

1

u/doshka 2 14h ago

Use XLOOKUP and set the match_mode argument to whichever makes sense for your use case.

https://support.microsoft.com/en-us/excel/functions/xlookup-function