Matching formula that is too hard for me!

bran987

New Member
Joined
Jan 10, 2005
Messages
45
Hi everyone,

Here are the things that are in each column.

Column A - Phone Numbers
Column B - Dates
Column C - Dates
Column D - Record ID's
Column E - BLANK
Column F - Dates
Column G - Phone Numbers

I'm trying to write a matching or lookup formula that looks up and down these columns and does this:

If A MATCHES G
and F is ON or BETWEEN B and C
then return the value in column D into column E

I really appreciate you guys you've helped me so much over the years.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Try this

Code:
=IF(AND(A2=G2,B2<=F2,C2>=F2),D2,"")
 
Upvote 0
Hi DanteAmor,

Thank you, I guess I wasn't totally clear. The phone numbers in columns A and G could be on totally different rows, so I'm trying to make it so it looks all the way up and down both of columns A and G to find matches before it does the rest of the formula.

If I knew how to post a screenshot for you I promise I would! Does that make sense?
 
Upvote 0
Is there a thread that teaches me how to post an example so you can see it? I don't think I was being clear enough.
 
Upvote 0
Is this what you want


Excel 2013/2016
ABCDEFG
2AL1 1HB01/01/201901/02/2019d2 11/01/2019AL5 5AX
3AL1 1WB02/01/201902/02/2019d312/01/2019AL5 4NG
4AL1 2NF03/01/201903/02/2019d413/01/2019AL5 3QA
5AL1 4HF04/01/201904/02/2019d514/01/2019AL5 2UR
6AL1 5JW05/01/201905/02/2019d6d2615/01/2019AL5 2GX
7AL10 0PY06/01/201906/02/2019d7d2516/01/2019AL5 1QE
8AL10 1DJ07/01/201907/02/2019d8d2417/01/2019AL4 9YZ
9AL10 8LG08/01/201908/02/2019d9d2318/01/2019AL4 9NH
10AL10 9NE09/01/201909/02/2019d10d2219/01/2019AL4 8WD
11AL2 1AU10/01/201910/02/2019d11d2120/01/2019AL4 8EG
12AL2 2ES11/01/201911/02/2019d12d2021/01/2019AL4 0SP
13AL2 3PT12/01/201912/02/2019d13d1922/01/2019AL4 0EL
14AL3 4AT13/01/201913/02/2019d14d1823/01/2019AL3 8JR
15AL3 5LE14/01/201914/02/2019d15d1724/01/2019AL3 7NS
16AL3 6RJ15/01/201915/02/2019d16d1625/01/2019AL3 6RJ
17AL3 7NS16/01/201916/02/2019d17d1526/01/2019AL3 5LE
18AL3 8JR17/01/201917/02/2019d18d1427/01/2019AL3 4AT
19AL4 0EL18/01/201918/02/2019d19d1328/01/2019AL2 3PT
20AL4 0SP19/01/201919/02/2019d20d1229/01/2019AL2 2ES
21AL4 8EG20/01/201920/02/2019d21d1130/01/2019AL2 1AU
22AL4 8WD21/01/201921/02/2019d2231/01/2019AL10 9NE
23AL4 9NH22/01/201922/02/2019d2301/02/2019AL10 8LG
24AL4 9YZ23/01/201923/02/2019d2402/02/2019AL10 1DJ
25AL5 1QE24/01/201924/02/2019d2503/02/2019AL10 0PY
26AL5 2GX25/01/201925/02/2019d2604/02/2019AL1 5JW
TB1
Cell Formulas
RangeFormula
E2{=IFERROR(INDEX($D$2:$D$30,MATCH(1,($G$2:$G$30=A2)*($F$2:$F$30>=B2)*($F$2:$F$30<=C2),0)),"")}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Book1
ABCDEFG
1Phone NumberDateDateRecord IDResultDatePhone Number
2214-986-777712/30/20191/5/20201001/3/2020214-986-7777
3214-976-555512/30/20191/5/20202003001/7/2020214-765-0989
4214-765-09891/6/20201/13/20203005/2/2019214-986-7777
5214-473-09091/6/20201/13/20204005001/9/2020214-473-0909
6214-473-09091/6/20201/13/20205001/2/2020214-986-7777
Sheet1


I figured out how to post in HTML! See how the phone number in G5 matches the phone number in A6, and because the date in F5 is between the dates in B6 and C6, it returns the value in D6 up into E5?
 
Upvote 0
ABCDEFG
Phone NumberDateDateRecord IDResultDatePhone Number
214-986-7777214-986-7777
214-976-5555214-765-0989
214-765-0989214-986-7777
214-473-0909214-473-0909
214-473-0909214-986-7777

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]12/30/2019[/TD]
[TD="align: right"]1/5/2020[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"][/TD]
[TD="align: right"]1/3/2020[/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]12/30/2019[/TD]
[TD="align: right"]1/5/2020[/TD]
[TD="align: right"]200[/TD]
[TD="align: right"]300[/TD]
[TD="align: right"]1/7/2020[/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]1/6/2020[/TD]
[TD="align: right"]1/13/2020[/TD]
[TD="align: right"]300[/TD]
[TD="align: right"][/TD]
[TD="align: right"]5/2/2019[/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]1/6/2020[/TD]
[TD="align: right"]1/13/2020[/TD]
[TD="align: right"]400[/TD]
[TD="align: right"]500[/TD]
[TD="align: right"]1/9/2020[/TD]

[TD="align: center"]6[/TD]

[TD="align: right"]1/6/2020[/TD]
[TD="align: right"]1/13/2020[/TD]
[TD="align: right"]500[/TD]
[TD="align: right"][/TD]
[TD="align: right"]1/2/2020[/TD]

</tbody>
Sheet1



I figured out how to post in HTML! See how the phone number in G5 matches the phone number in A6, and because the date in F5 is between the dates in B6 and C6, it returns the value in D6 up into E5?


try this


<table border="1" cellspacing="0" style="font-family:Calibri,Arial; font-size:11pt; background-color:#ffffff; "> <colgroup><col style="font-weight:bold; width:30px; " /><col style="width:98.85px;" /><col style="width:106.46px;" /><col style="width:103.6px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:143.52px;" /><col style="width:134.02px;" /></colgroup><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td > </td><td >A</td><td >B</td><td >C</td><td >D</td><td >E</td><td >F</td><td >G</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >1</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">PHONE</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">DATES</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">DATES</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">ID</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">RESULT</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">DATES</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">PHONE</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >2</td><td >214-986-7777</td><td style="text-align:right; ">30/dic/2019</td><td style="text-align:right; ">05/ene/2020</td><td style="text-align:right; ">100</td><td > </td><td style="text-align:right; ">03/ene/2020</td><td >214-986-7777</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >3</td><td >214-976-5555</td><td style="text-align:right; ">30/dic/2019</td><td style="text-align:right; ">05/ene/2020</td><td style="text-align:right; ">200</td><td style="text-align:right; ">300</td><td style="text-align:right; ">07/ene/2020</td><td >214-765-0989</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >4</td><td >214-765-0989</td><td style="text-align:right; ">06/ene/2020</td><td style="text-align:right; ">13/ene/2020</td><td style="text-align:right; ">300</td><td > </td><td style="text-align:right; ">02/may/2019</td><td >214-986-7777</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >5</td><td >214-473-0909</td><td style="text-align:right; ">06/ene/2020</td><td style="text-align:right; ">13/ene/2020</td><td style="text-align:right; ">400</td><td style="text-align:right; ">500</td><td style="text-align:right; ">09/ene/2020</td><td >214-473-0909</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >6</td><td >214-473-0909</td><td style="text-align:right; ">06/ene/2020</td><td style="text-align:right; ">13/ene/2020</td><td style="text-align:right; ">500</td><td > </td><td style="text-align:right; ">02/ene/2020</td><td >214-986-7777</td></tr></table><br /><table style="font-family:Arial; font-size:10pt; border-style: groove ;border-color:#00ff00;background-color:#fffcf9; color:#000000; "><tr><td ><b></b></td></tr><tr><td ><table border = "1" cellspacing="0" cellpadding="2" style="font-family:Arial; font-size:9pt;"><tr style="background-color:#cacaca; font-size:10pt;"><td >Cell</td><td >Formula</td></tr><tr><td >E2</td><td >=IFERROR(INDEX($D$3:$D$7,SUMPRODUCT((A3:$A$7=G2)*(B3:$B$7<=F2)*(C3:$C$7>=F2)*(ROW(D3:$D$7)))-2),"")</td></tr></table></td></tr></table>
 
Upvote 0
try this


<table border="1" cellspacing="0" style="font-family:Calibri,Arial; font-size:11pt; background-color:#ffffff; "> <colgroup><col style="font-weight:bold; width:30px; " /><col style="width:98.85px;" /><col style="width:106.46px;" /><col style="width:103.6px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:143.52px;" /><col style="width:134.02px;" /></colgroup><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td > </td><td >A</td><td >B</td><td >C</td><td >D</td><td >E</td><td >F</td><td >G</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >1</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">PHONE</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">DATES</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">DATES</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">ID</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">RESULT</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">DATES</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">PHONE</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >2</td><td >214-986-7777</td><td style="text-align:right; ">30/dic/2019</td><td style="text-align:right; ">05/ene/2020</td><td style="text-align:right; ">100</td><td > </td><td style="text-align:right; ">03/ene/2020</td><td >214-986-7777</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >3</td><td >214-976-5555</td><td style="text-align:right; ">30/dic/2019</td><td style="text-align:right; ">05/ene/2020</td><td style="text-align:right; ">200</td><td style="text-align:right; ">300</td><td style="text-align:right; ">07/ene/2020</td><td >214-765-0989</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >4</td><td >214-765-0989</td><td style="text-align:right; ">06/ene/2020</td><td style="text-align:right; ">13/ene/2020</td><td style="text-align:right; ">300</td><td > </td><td style="text-align:right; ">02/may/2019</td><td >214-986-7777</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >5</td><td >214-473-0909</td><td style="text-align:right; ">06/ene/2020</td><td style="text-align:right; ">13/ene/2020</td><td style="text-align:right; ">400</td><td style="text-align:right; ">500</td><td style="text-align:right; ">09/ene/2020</td><td >214-473-0909</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >6</td><td >214-473-0909</td><td style="text-align:right; ">06/ene/2020</td><td style="text-align:right; ">13/ene/2020</td><td style="text-align:right; ">500</td><td > </td><td style="text-align:right; ">02/ene/2020</td><td >214-986-7777</td></tr></table><br /><table style="font-family:Arial; font-size:10pt; border-style: groove ;border-color:#00ff00;background-color:#fffcf9; color:#000000; "><tr><td ><b></b></td></tr><tr><td ><table border = "1" cellspacing="0" cellpadding="2" style="font-family:Arial; font-size:9pt;"><tr style="background-color:#cacaca; font-size:10pt;"><td >Cell</td><td >Formula</td></tr><tr><td >E2</td><td >=IFERROR(INDEX($D$3:$D$7,SUMPRODUCT((A3:$A$7=G2)*(B3:$B$7<=F2)*(C3:$C$7>=F2)*(ROW(D3:$D$7)))-2),"")</td></tr></table></td></tr></table>


Thanks Dante! I had to add some $'s, change all the 3's in the formulas to 2's, and it ended up being -1 that worked on the ROW part instead of -2 (don't know why) but now it works!!!!!!!!
Many thanks!
 
Upvote 0
Thanks Dante! I had to add some $'s, change all the 3's in the formulas to 2's, and it ended up being -1 that worked on the ROW part instead of -2 (don't know why) but now it works!!!!!!!!
Many thanks!

The formula starts at E2, but it should only be checked at E3 down.
The E6 formula will only revise the E7. According to the logic after E6 there is nothing that can go up.

The important thing is that now it works for you.
It was a pleasure to help you.
 
Upvote 0

Forum statistics

Threads
1,223,891
Messages
6,175,229
Members
452,621
Latest member
Laura_PinksBTHFT

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