multiple lookup question

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
I would like to find out those days that either NY temperature of 29 or higher or LA had a temperature 26 or higher. I would like to know the date that it occurred and what the Price and Nextday-prices were. Any help would be very much appreciated. Thank you.

Sample of the data

[TABLE="class: grid, width: 560"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Date[/TD]
[TD]NY temperature[/TD]
[TD]LA temperature[/TD]
[TD]Price[/TD]
[TD]Nextday price[/TD]
[/TR]
[TR]
[TD="align: right"]02/07/2018[/TD]
[TD="align: right"]32.22[/TD]
[TD="align: right"]26.91[/TD]
[TD="align: right"]49.92[/TD]
[TD="align: right"]69.88[/TD]
[/TR]
[TR]
[TD="align: right"]03/07/2018[/TD]
[TD="align: right"]32.85[/TD]
[TD="align: right"]28.51[/TD]
[TD="align: right"]48.81[/TD]
[TD="align: right"]54.3[/TD]
[/TR]
[TR]
[TD="align: right"]05/07/2018[/TD]
[TD="align: right"]30.69[/TD]
[TD="align: right"]24.58[/TD]
[TD="align: right"]53.43[/TD]
[TD="align: right"]43.77[/TD]
[/TR]
[TR]
[TD="align: right"]06/07/2018[/TD]
[TD="align: right"]28.92[/TD]
[TD="align: right"]23.16[/TD]
[TD="align: right"]30.02[/TD]
[TD="align: right"]35.19[/TD]
[/TR]
[TR]
[TD="align: right"]09/07/2018[/TD]
[TD="align: right"]27.74[/TD]
[TD="align: right"]25.52[/TD]
[TD="align: right"]40.59[/TD]
[TD="align: right"]34.6[/TD]
[/TR]
[TR]
[TD="align: right"]10/07/2018[/TD]
[TD="align: right"]32.22[/TD]
[TD="align: right"]26.98[/TD]
[TD="align: right"]44.87[/TD]
[TD="align: right"]42.53[/TD]
[/TR]
[TR]
[TD="align: right"]11/07/2018[/TD]
[TD="align: right"]31.08[/TD]
[TD="align: right"]24.13[/TD]
[TD="align: right"]42.01[/TD]
[TD="align: right"]38.76[/TD]
[/TR]
[TR]
[TD="align: right"]12/07/2018[/TD]
[TD="align: right"]28.51[/TD]
[TD="align: right"]23.96[/TD]
[TD="align: right"]34.69[/TD]
[TD="align: right"]36.94[/TD]
[/TR]
</tbody>[/TABLE]

.
.
.

[TABLE="class: grid, width: 560"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD="align: right"]24/09/2018[/TD]
[TD="align: right"]19.06[/TD]
[TD="align: right"]17.15[/TD]
[TD="align: right"]23.27[/TD]
[TD="align: right"]31.95[/TD]
[/TR]
[TR]
[TD="align: right"]25/09/2018[/TD]
[TD="align: right"]24.55[/TD]
[TD="align: right"]20.03[/TD]
[TD="align: right"]31.98[/TD]
[TD="align: right"]37.05[/TD]
[/TR]
[TR]
[TD="align: right"]26/09/2018[/TD]
[TD="align: right"]26.22[/TD]
[TD="align: right"]19.17[/TD]
[TD="align: right"]35.34[/TD]
[TD="align: right"]37.4[/TD]
[/TR]
[TR]
[TD="align: right"]27/09/2018[/TD]
[TD="align: right"]17.01[/TD]
[TD="align: right"]14.34[/TD]
[TD="align: right"]27.04[/TD]
[TD="align: right"]32.37[/TD]
[/TR]
[TR]
[TD="align: right"]28/09/2018[/TD]
[TD="align: right"]20.56[/TD]
[TD="align: right"]16.63[/TD]
[TD="align: right"]30.24[/TD]
[TD="align: right"]30.97[/TD]
[/TR]
</tbody>[/TABLE]

The file can be downloaded here

https://drive.google.com/file/d/1G6K4jiLwNjLx4bllMxgmudJyGFCjPxTa/view?usp=sharing
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Book1
ABCDE
1DateNY temperatureLA temperaturePriceNextday price
22/7/201832.2226.9149.9269.88
33/7/201832.8528.5148.8154.3
45/7/201830.6924.5853.4343.77
56/7/201828.9223.1630.0235.19
69/7/201827.7425.5240.5934.6
710/7/201832.2226.9844.8742.53
811/7/201831.0824.1342.0138.76
912/7/201828.5123.9634.6936.94
Sheet1



Book1
ABCDEF
1NY29
2LA26
35
4IdxDateNY temperatureLA temperaturePriceNextday price
512/7/201832.2226.9149.9269.88
623/7/201832.8528.5148.8154.3
735/7/201830.6924.5853.4343.77
8610/7/201832.2226.9844.8742.53
9711/7/201831.0824.1342.0138.76
Sheet2


In A3 control+shift+enter, not just enter:

=SUM(IF((Sheet1!B2:B9>=B1)+(Sheet1!C2:C9>=B2),1))

In A5, control+shift+enter, not just enter, and copy down:

=IF(ROWS($1:1)>$A$3,"",SMALL(IF((Sheet1!$B$2:$B$9>=$B$1)+(Sheet1!$C$2:$C$9>=$B$2),ROW(Sheet1!$A$2:$E$9)-ROW(INDEX(Sheet1!$A$2:$E$9,1,1))+1),ROWS($1:1)))

In B5 just enter, copy across, and down:

=IF($A5="","",INDEX(Sheet1!$A$2:$E$9,$A5,MATCH(B$4,Sheet1!$A$1:$E$1,0)))
 
Upvote 0
Thank you so much for all your help. I will go through them now to understand them. Just a question. Can that be solved by using pivot table or not possible with pivot tables? Thank you so much once again.
 
Upvote 0
Thank you so much for all your help. I will go through them now to understand them. Just a question. Can that be solved by using pivot table or not possible with pivot tables? Thank you so much once again.


Book1
ABCDEF
1DateNY temperatureLA temperaturePriceNextday priceCRIT
22/7/201832.2226.9149.9269.88TRUE
33/7/201832.8528.5148.8154.3TRUE
45/7/201830.6924.5853.4343.77TRUE
56/7/201828.9223.1630.0235.19FALSE
69/7/201827.7425.5240.5934.6FALSE
710/7/201832.2226.9844.8742.53TRUE
811/7/201831.0824.1342.0138.76TRUE
912/7/201828.5123.9634.6936.94FALSE
Sheet1


In F2 enter and copy down:

=(B2>=29)+(C2>=26)>0


Book1
ABCDE
1CRITTRUE
2
3Row LabelsSum of NY temperatureSum of LA temperatureSum of PriceSum of Nextday price
47-Feb32.2226.9149.9269.88
57-Mar32.8528.5148.8154.3
67-May30.6924.5853.4343.77
77-Oct32.2226.9844.8742.53
87-Nov31.0824.1342.0138.76
9Grand Total159.06131.11239.04249.24
10
Sheet5
 
Upvote 0
Many thanks. I will try to understand this as well. Thank you so much.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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