Lookup or calculate nearest bigger value of table items where items are not unique.

888ta8pa

New Member
Joined
Apr 21, 2018
Messages
1
Dear All Excel MASTERS, HLEP!

Let's say I have an excel file which have 2 sheets : "Inbox" and "Sent"
in those sheets, there are 2 columns : "Name" and "SCORE"
what I am trying to do, is to always get the nearest bigger "Score" (minimum value which is bigger) for any "Name" in the "Inbox" table, from the "Sent" Table. Please think of sheets bellow :

Inbox Table :


beh89
beh80
jack75
mat74
dave55
moe43
james38
beh36

<tbody>
</tbody>

Sent table :

joe95
beh85
ray80
beh75
dave60
james35
fred30
beh30

<tbody>
</tbody>

the goal is to get result like the bellow :

joe95Error or "0"
beh8589
ray80Error or "0"
beh7580
dave6055
james3538
fred30Error or "0"
beh3036

<tbody>
</tbody>

I tried many formulas for this, as you can see in bellow screenshot, after hours! I managed to find out I NEED HELP! then if you Excel masters help me solve this, I really would appreciate it.

the closest formula I have used is as bellow :

Code:
{=IF(Inbox!A2=Sent!$A$1:$A$8,MIN(IF(Sent!$B$1:$B$8>Inbox!B2,Sent!$B$1:$B$8)))}

large

screenshot, lot's of try! no luck. only the first two columns are data! others are my failures!
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

the goal is to get result like the bellow :

joe95Error or "0"
beh8589
ray80Error or "0"
beh7580
dave6055
james3538
fred30Error or "0"
beh3036

<tbody>
</tbody>
Hi!

Maybe the formula below can helps.

Array Formula - use Ctrl+Shift+Enter to enter the formula

In C2 and copy down

=IFERROR(IF(1/VLOOKUP(A2,InBox!A$2:B$9,2,0),
1/(1/LARGE(INDEX((InBox!A$2:A$9=A2)*InBox!B$2:B$9,),COUNTIF(A$2:A2,A2)))),"Error or 0")


ABCDABC
1NameScoreResultSent1NameScoreInBox
2joe95Error or 02beh89
3beh85893beh80
4ray80Error or 04jack75
5beh75805mat74
6dave60556dave55
7james35387moe43
8fred30Error or 08james38
9beh30369beh36
1010
************************************************************

<tbody>
</tbody>


Markmzz
 
Last edited:
Upvote 0
@ 888ta8pa

Your goal specification implies a formula in the Sent sheet. If so,

In C2 of Sent, control+shift+enter, not just enter, and copy down:

=IF(COUNTIFS(Inbox!$A$2:$A$9,$A2,Inbox!$B$2:$B$9,">"&$B2),MIN(IF(Inbox!$A$2:$A$9=$A2,IF(Inbox!$B$2:$B$9>$B2,Inbox!$B$2:$B$9))),"not available")
 
Upvote 0
Hi!

A small modification (use only Enter to enter the formula). In C2 and copy down

=IFERROR(IF(1/VLOOKUP(A2,InBox!A$2:B$9,2,0),
INDEX(1/(1/LARGE((InBox!A$2:A$9=A2)*InBox!B$2:B$9,COUNTIF(A$2:A2,A2))),)),"Error or 0")


Markmzz
 
Upvote 0
Hi!

Another small modification (Array Formula - use Ctrl+Shift+Enter to enter the formula). In C2 and copy down.

=IFERROR(IF(1/VLOOKUP(A2,InBox!A$2:B$9,2,0),
1/(1/LARGE((InBox!A$2:A$9=A2)*InBox!B$2:B$9,COUNTIF(A$2:A2,A2)))),"Error or 0")


Markmzz
 
Last edited:
Upvote 0
Hi!

One more (Array Formula - use Ctrl+Shift+Enter to enter the formula). In C2 and copy down.

=IFERROR(IF(1/VLOOKUP(A2,InBox!A$2:B$9,2,0),
1/(1/LARGE((InBox!A$2:A$9=A2)*(InBox!B$2:B$9>=B2)*InBox!B$2:B$9,COUNTIF(A$2:A2,A2)))),"Error or 0")

Markmzz
 
Last edited:
Upvote 0
Hi 888ta8pa,

I have one question for you: What you want for dave and for last record of beh? And why?

Markmzz
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,922
Messages
6,122,281
Members
449,075
Latest member
staticfluids

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
Back
Top