V Look Up / X Look Up subject to conditions

ap_terminator

New Member
Joined
Jun 5, 2022
Messages
20
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I'm trying to pull data out subject to certain conditions, I have attached a simple version of what I'm actually doing. I need to fill in the yellow highlighted area, pulling out the correct amount for each country which has a EUR, GBP or USD FX rate.

For example in Column G i need a total of EUR 320,500 (A - 200,000, D - 76,000 , C - 44,500 with the rest of the cells in column G being 0). Note some of the countries in column A repeat but with a different FX rate e.g. country A.
Screenshot 2022-07-11 224419.png


Thanks.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
The problem with your layout is that for countries that appear more than once (A for example), you'd end up looking up some values more than once. In this case G3 would be the intersection of A and EUR, so it would look up 200,000. But G10 is also the intersection of A and EUR, so it would look up 200,000 again. (See Table 2 below.) So we need a way to find unique values. I came up with 2 methods. Table3 consists of 3 formulas, all the same, but they find the countries with a given currency and just include those in each column. Table 4 I like a bit better. Each country is listed just once, but the grid has each currency. That takes just 2 formulas, one for the unique country list, one for the totals.

Book1
ABCDEFGHIJKLMNOPQRSTU
1Table 1Table 2Table 3Table 4
2CountryCurrencyAmountCountryEURGBPUSDEURGBPUSDEURGBPUSD
3AEUR200000A20000010000000A200000B456878C34998A20000010000000
4BGBP456878B045687816000D76000E12889B16000B045687816000
5CUSD34998C44500034998C44500F100000C44500034998
6DEUR76000D7600000A1000000D7600000
7EGBP12889E0128890E0128890
8FGBP100000F01000000F01000000
9AGBP1000000A20000010000000
10BUSD16000B045687816000
11CEUR44500C44500034998
12
13Total5650003026645101996320500156976750998320500156976750998
Sheet6
Cell Formulas
RangeFormula
G3:I11G3=SUMIFS($C:$C,$A:$A,$F3,$B:$B,G$2)
K3:L5,O3:P4,M3:N6K3=FILTER(FILTER($A$3:$C$11,$B$3:$B$11=K2),{1,0,1})
R3:R8R3=SORT(UNIQUE(A3:A11))
S3:U8S3=SUMIFS(C:C,A:A,R3#,B:B,S2:U2)
G13:I13,S13:U13,P13,N13,L13G13=SUM(G3:G11)
Dynamic array formulas.


Let us know if any of these work for you.
 
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,746
Members
448,989
Latest member
mariah3

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