Formula which looks across Column for and with same value then applies formula

tomcavs

New Member
Joined
Dec 11, 2018
Messages
8
Hi,

I require a function which looks at a ID in a certain column and only compares values across respective rows for that ID:

1) Function looks at cells containing the same ID
2) Looks at which currency is first alphabetically and then if PAY or REC to determine the Buyer

Issue I am having is restricting the formula to just check across Rows where the ID is the same when dragging down the column

IDCurrencyValueBuyer
503CADRECBuyer
503USDPAY
503CADPAY
503USDREC
504CADPAY
504USDREC
504CADRECBuyer
504USDPAY

<tbody>
</tbody>

<tbody>
</tbody>
Thanks,
Tom
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
For each ID I need to ascertain who is the BUYER for each group of ID's, the condition is BUYER = REC & CCY first alphabetically.

I built a list of alphabetical currencies and numbered them. The key is comparing both REC/PAYs and the CCY's but just restricting the function to that ID as I drag down.
 
Upvote 0
Care to post the output for this sample for the conditions you specify? I guess the answer/the output is obvious to you, but it's not necessarily so for others, hence the request. It's not clear for example whether you want the buyer name or the currency...



Book1
ABCDEFG
1IDCurrencyValueBuyer503tom
2503CADRECtom504dan
3503USDPAY
4503CADPAY
5503USDREC
6504CADPAY
7504USDREC
8504CADRECdan
9504USDPAY
Sheet1


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

=INDEX($D$2:$D$9,MATCH(F1,IF($C$2:$C$9="REC",IF(1-($D$2:$D$9=""),$A$2:$A$9)),0))
 
Upvote 0
Is this what you are looking for:



Book1
ABCD
1IDCurrencyValueBuyer
2503CADRECBuyer
3503USDPAY
4503CADPAY
5503USDREC
6504CADPAY
7504USDREC
8504CADRECBuyer
9504USDPAY
10
Sheet6
Cell Formulas
RangeFormula
D2{=IF((1-COUNTIFS(A$1:A1,A2,D$1:D1,"Buyer"))*(C2="REC"),IF(CHAR(MIN(IF(A$1:A2=A2,CODE(MID(B$1:B2,1,1)))))=MID(B2,1,1),"Buyer",""),"")}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Sorry, thanks for help.

The output field is BUYER. We need know who the buyer is by ascertaining who receives the currency which is first alphabetically for each trade.

Need to restrict the lookup to each ID. Hope this clarifies?
 
Upvote 0
Sorry, thanks for help.

The output field is BUYER. We need know who the buyer is by ascertaining who receives the currency which is first alphabetically for each trade.

Need to restrict the lookup to each ID. Hope this clarifies?

No it doesn't. Whay don't you try to post the output which is associated with the sample you posted?
 
Upvote 0
Ok, one last try...

The below are FX swap transactions, to determine the buyer (Buying Entity) I require a formula that looks individually at each transaction reference (4 below) and ascertain the Buyer by:

Looking at each transaction number
decipher which currency across the transaction number is first alphabetically, (currently done by a separate numbered list)
Then determine who is receiving that currency.
For the corresponding line the Entity column will be the Buyer

i.e. the Buyer is the Entity which receives the currency that is first alphabetically. Require a drag down rule to decipher

Transaction refEntityCounterpartyCurrencyPAY / RECAlphabetical orderBuy / SellBuyer
D10517028ABC LTDABC IncEURRECFirstBuyABC LTD
D10517028ABC LTDABC IncUSDPAYSecondSell
D20517028ABC LTDABC IncEURPAYFirstSell
D20517028ABC LTDABC IncUSDRECSecondSell
D10517029ABC IncABC LTDEURPAYFirstSell
D10517029ABC IncABC LTDUSDRECSecondSell
D20517029ABC IncABC LTDEURRECFirstBuyABC Inc
D20517029ABC IncABC LTDUSDPAYSecondSell

<tbody>
</tbody>

Thanks,
Tom
 
Upvote 0
In H2 control+shift+enter, not just enter, and copy down:

=IF($G2="buy",INDEX($B$2:$B$9,MATCH(MIN(IF($A$2:$A$9=A2,IF($G$2:$G$9="buy",CODE(LEFT(UPPER($D$2:$D$9))),""),"")),IF($A$2:$A$9=A2,IF($G$2:$G$9="buy",CODE(LEFT(UPPER($D$2:$D$9))),""),""),0)),"")
 
Upvote 0
This looks good. except the Buy / Sell is an output field. I need to formula to look at Currency vs. PAY / REC.

Buyer is the Entity which receives the currency that is first alphabetically. Require a drag down rule to decipher
 
Upvote 0

Forum statistics

Threads
1,214,630
Messages
6,120,634
Members
448,973
Latest member
ChristineC

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