MAXIFS/MINIFS

phillipus2005

New Member
Joined
Jun 29, 2018
Messages
34
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
  3. Mobile
Hi

I have a long normalised table of data (research results for multiple countries in multiple waves). I am looking for a formula to identify the earliest and latest results for each question per market. In the table below, I would like to have "baseline" returned in column O for the earliest wave in each country for which there is data in column N and "latest" returned in column O for the latest wave in each country for which there is data in column N. The trouble is that in some countries, in some waves, the question was not asked at first so the "baseline" label refers to a blank score in column N so when pivoting the data to show change from baseline, it skews the results... i.e. in the below, "baseline" should be in O3 for Country 1 NOT O2.

My current formula returns "baseline" for the earliest wave (column M) per country (column L), i.e. O2, below. I can't figure out how to also factor in Column N. My current formula is: =IF(MAXIFS([Wave],[Market],[@Market])=[@Wave], "Latest", IF(MINIFS([Wave],[Market],[@Market])=[@Wave], "Baseline", ""))

Any help on how to modify this would be much appreciated - i've tried adding in another condition in the maxifs and minifs but they return blank in O3 (i guess because M2 is not the max/min)

Thanks in advance

LMNO
1​
CountryWaveScoreBaseline/latest
2​
Country 1
1​
Baseline
3​
Country 1
2​
10​
4​
Country 1
3​
20​
Latest
5​
Country 2
1​
10​
Baseline
6​
Country 2
2​
15​
7​
Country 2
3​
20​
Latest
 

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.
Is this what you are after?

24 02 22.xlsm
LMNO
1CountryWaveScoreBaseline/latest
2Country 11 
3Country 1210Baseline
4Country 1320Latest
5Country 2110Baseline
6Country 2215 
7Country 2320Latest
Baseline
Cell Formulas
RangeFormula
O2:O7O2=IF(COUNTIFS(L$2:L2,L2,N$2:N2,"<>")=1,"Baseline",IF(COUNTIFS(L2:L$7,L2,N2:N$7,"<>")=1,"Latest",""))
 
Upvote 0
Hi - thanks - yes it is... sort of
I can't figure out how it works - how would i apply it to an excel dynamic table?
 
Upvote 0
how would i apply it to an excel dynamic table?

phillipus2005.xlsm
LMNO
1CountryWaveScoreBaseline/latest
2Country 11 
3Country 1210Baseline
4Country 1320Latest
5Country 2110Baseline
6Country 2215 
7Country 2320Latest
Baseline
Cell Formulas
RangeFormula
O2:O7O2=IF(COUNTIFS(INDEX([Country],1):[@Country],[@Country],INDEX([Score],1):[@Score],"<>")=1,"Baseline",IF(COUNTIFS([@Country]:INDEX([Country],ROWS([Country])),[@Country],[@Score]:INDEX([Score],ROWS([Score])),"<>")=1,"Latest",""))
 
Upvote 0
Hi - this doesn't quite work - in case helpful, here is a more detailed table with three columns at the end showing: (1) what my original formula returned, (2) what it should show, and (3) what your formula returned...

Any advice greatly appreciated - you'll see the use case i'm trying to deal with is how to handle "Baseline" data that was not in the first wave of the research (Wave 0)... I've highlighted in red text below where this is an issue...

Thank you again

MarketSegmentSectionSubsectionWaveDateScoreWhat it currently shows (my original formula)What it should showWhat your formula returned
Country 1GenPopAwarenessFamiliar with XXXX0Dec-2081BaselineBaselineBaseline
Country 1GenPopAwarenessFamiliar with YYYY0Dec-2056BaselineBaseline
Country 1GenPopPerceptionsXXXX is a positive development0Dec-2027BaselineBaseline
Country 1GenPopPerceptionsYYYY is a positive development0Dec-2021BaselineBaseline
Country 1GenPopAwarenessFamiliar with XXXX1Dec-2182
Country 1GenPopAwarenessFamiliar with YYYY1Dec-2140
Country 1GenPopPerceptionsXXXX is a positive development1Dec-2189
Country 1GenPopPerceptionsYYYY is a positive development1Dec-2172
Country 1GenPopAwarenessFamiliar with XXXX2Jul-2359
Country 1GenPopAwarenessFamiliar with YYYY2Jul-2360
Country 1GenPopPerceptionsXXXX is a positive development2Jul-2378
Country 1GenPopPerceptionsYYYY is a positive development2Jul-2362
Country 1GenPopAwarenessFamiliar with XXXX3Dec-2391LatestLatest
Country 1GenPopAwarenessFamiliar with YYYY3Dec-2368LatestLatest
Country 1GenPopPerceptionsXXXX is a positive development3Dec-2356LatestLatest
Country 1GenPopPerceptionsYYYY is a positive development3Dec-2361LatestLatestLatest
Country 2GenPopAwarenessFamiliar with XXXX0Dec-20BaselineBaseline
Country 2GenPopAwarenessFamiliar with YYYY0Dec-20Baseline
Country 2GenPopPerceptionsXXXX is a positive development0Dec-20Baseline
Country 2GenPopPerceptionsYYYY is a positive development0Dec-20Baseline
Country 2GenPopAwarenessFamiliar with XXXX1Dec-2182Baseline
Country 2GenPopAwarenessFamiliar with YYYY1Dec-2140Baseline
Country 2GenPopPerceptionsXXXX is a positive development1Dec-2189Baseline
Country 2GenPopPerceptionsYYYY is a positive development1Dec-2172Baseline
Country 2GenPopAwarenessFamiliar with XXXX2Jul-2359
Country 2GenPopAwarenessFamiliar with YYYY2Jul-2360
Country 2GenPopPerceptionsXXXX is a positive development2Jul-2378
Country 2GenPopPerceptionsYYYY is a positive development2Jul-2362
Country 2GenPopAwarenessFamiliar with XXXX3Dec-2391LatestLatest
Country 2GenPopAwarenessFamiliar with YYYY3Dec-2368LatestLatest
Country 2GenPopPerceptionsXXXX is a positive development3Dec-2356LatestLatest
Country 2GenPopPerceptionsYYYY is a positive development3Dec-2361LatestLatestLatest
 
Upvote 0
in case helpful, here is a more detailed table
It certainly is more helpful as it appears Date is relevant and Date was not mentioned or shown in the original information so I assumed "earliest" and "latest" simply meant first/last in the column. :eek:

See if this is closer.

phillipus2005.xlsm
AFGIK
1MarketDateScoreshould showNew Try
2Country 1Dec-2081BaselineBaseline
3Country 1Dec-2056BaselineBaseline
4Country 1Dec-2027BaselineBaseline
5Country 1Dec-2021BaselineBaseline
6Country 1Dec-2182 
7Country 1Dec-2140 
8Country 1Dec-2189 
9Country 1Dec-2172 
10Country 1Jul-2359 
11Country 1Jul-2360 
12Country 1Jul-2378 
13Country 1Jul-2362 
14Country 1Dec-2391LatestLatest
15Country 1Dec-2368LatestLatest
16Country 1Dec-2356LatestLatest
17Country 1Dec-2361LatestLatest
18Country 2Dec-20 
19Country 2Dec-20 
20Country 2Dec-20 
21Country 2Dec-20 
22Country 2Dec-2182BaselineBaseline
23Country 2Dec-2140BaselineBaseline
24Country 2Dec-2189BaselineBaseline
25Country 2Dec-2172BaselineBaseline
26Country 2Jul-2359 
27Country 2Jul-2360 
28Country 2Jul-2378 
29Country 2Jul-2362 
30Country 2Dec-2391LatestLatest
31Country 2Dec-2368LatestLatest
32Country 2Dec-2356LatestLatest
33Country 2Dec-2361LatestLatest
Sheet2
Cell Formulas
RangeFormula
K2:K33K2=IF([@Date]=MINIFS([Date],[Market],[@Market],[Score],"<>"),"Baseline",IF([@Date]=MAXIFS([Date],[Market],[@Market],[Score],"<>"),"Latest",""))
 
Upvote 0
Solution
Thank you - this is PERFECT. I was using Wave as a proxy for the date (as the earliest is wave 0)... it looks like i was getting the formula to determine if score is blank wrong

Thank you again!!!
 
Upvote 0
You're welcome. Glad we got it sorted in the end. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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