Extract Conditional Data

Graemea

Board Regular
Joined
Oct 30, 2015
Messages
119
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have sample sales data as in A1:AZ7 in the screenshot below.

I would like to create a formula that, for each Product Code, returns the country associated with a value that isn't "-" and is closest in position to the last column in the range.

In my example, Germany would be extracted against AAA and Italy for BBB.

Can someone please suggest a formula to achieve this?

Thanks!

PS the dates in row 1 are text, not numbers


Excel.PNG
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi Graemea,

Try the below ...

Test.xlsx
ABCDEFGHIJKLMNO
1ProductProductRegionCountry31-Dec-1531-Jan-1629-Feb-1631-Mar-1630-Apr-1631-May-1630-Jun-1631-Jul-1631-Aug-1630-Sep-1631-Oct-16
2AAAAppleEuropeUK-100100100100100100100100--
3AAAAppleEuropeFrance--100100100100100100100--
4AAAAppleEuropeGermany---100100100100100100100-
5BBBBananaEuropeSpain--100100100100100100---
6BBBBananaEuropeItaly---100100100100100100--
7BBBBananaEuropePortugal-100100100100100100100---
8CCCCucumberEuropeSwitzerland---100-------
9CCCCucumberEuropeNetherland---100100100-----
10CCCCucumberEuropeAustria--100100100------
11
12
13AAAGermany
14BBBItaly
15CCCNetherland
Sheet1
Cell Formulas
RangeFormula
F1:O1F1=EOMONTH(E1,1)
B13:B15B13=INDEX($D$1:$D$10,LARGE(IF($A$2:$A$10=A13,IF(COLUMN($A$2:$O$10)=LARGE(IF($A$2:$A$10=A13,IF($A$2:$O$10<>"-",COLUMN($A$2:$O$10),0),0),1),IF($A$2:$O$10<>"-",ROW($A$2:$A$10),0),0),0),1))
 
Upvote 0
That's awesome, thank you!

A last quick question, if i may: does this not need to be an array function (i.e. with Ctrl-Alt-Delete)?
 
Upvote 0
It should work without CSE as Index & Large functions accept arrays. I have office 365 it works as expected without CSE. Which office version you have ? Have you tried it? Does it work or not ?
 
Upvote 0

Forum statistics

Threads
1,215,633
Messages
6,125,928
Members
449,274
Latest member
mrcsbenson

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