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

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

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")


[TABLE="class: grid, width: 490"]
<tbody>[TR]
[TD][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]Name[/TD]
[TD="align: center"]Score[/TD]
[TD="align: center"]Result[/TD]
[TD="align: center"]Sent[/TD]
[TD="align: center"][/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]Name[/TD]
[TD="align: center"]Score[/TD]
[TD="align: center"]InBox[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]joe[/TD]
[TD="align: center"]95[/TD]
[TD="align: center"]Error or 0[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]beh[/TD]
[TD="align: center"]89[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]beh[/TD]
[TD="align: center"]85[/TD]
[TD="align: center"]89[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]beh[/TD]
[TD="align: center"]80[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]ray[/TD]
[TD="align: center"]80[/TD]
[TD="align: center"]Error or 0[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]jack[/TD]
[TD="align: center"]75[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]beh[/TD]
[TD="align: center"]75[/TD]
[TD="align: center"]80[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]mat[/TD]
[TD="align: center"]74[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]dave[/TD]
[TD="align: center"]60[/TD]
[TD="align: center"]55[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]6[/TD]
[TD="align: center"]dave[/TD]
[TD="align: center"]55[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"]james[/TD]
[TD="align: center"]35[/TD]
[TD="align: center"]38[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]moe[/TD]
[TD="align: center"]43[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD="align: center"]fred[/TD]
[TD="align: center"]30[/TD]
[TD="align: center"]Error or 0[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]james[/TD]
[TD="align: center"]38[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD="align: center"]beh[/TD]
[TD="align: center"]30[/TD]
[TD="align: center"]36[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]beh[/TD]
[TD="align: center"]36[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]10[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]10[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]***[/TD]
[TD="align: center"]********[/TD]
[TD="align: center"]********[/TD]
[TD="align: center"]********[/TD]
[TD="align: center"]******[/TD]
[TD="align: center"]**[/TD]
[TD="align: center"]***[/TD]
[TD="align: center"]********[/TD]
[TD="align: center"]********[/TD]
[TD="align: center"]******[/TD]
[/TR]
</tbody>[/TABLE]


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,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

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