Formula to find the Average using 4 Criteria's which are need to be extracted using isnumber, search & average

suresh7860

New Member
Joined
Jul 18, 2015
Messages
48
Hello Experts:

I am looking for a formula that can help me to get the average of the multiple period results for the control id's by using Company Name; Code; Activity.

The only ID will be in the defined format but other columns will not be inconsistent. But Company Name will be same like MNO similar for all the times listed and similarly, Code also likes 105 will be same for all the times it's listed in the report and even the activity X012.03.01 which will be listed similarly for all the times listed in the report.

ID#456
Company Name#MNO
Code#105
Activity#X012.03.01

The result should be an average of the similar combinations of how many times listed in the report and create an average for the same key.

In this example, we have twice and the average result for this is 90. Average of 100 (Jan'21) + 80 (Feb'21) / 2 (listed twice)

IDCompany NameCodeActivityResultPeriod
123​
ABC|XYZ.|DEF|MNO|QRS101|108|205|225|171X001.01.02|X012.02.01|X018.01.05
90​
Jan'21
456​
MNO|XYZ.|RVS225|229|105|101|201X001.01.02|X012.03.01|X019.02.03
100​
Jan'21
235​
ABC|QRS201|205|701X001.01.02|X012.04.01|X022.05.01|X123.01.05|X027.02.03
85​
Jan'21
456​
QRS|XYZ|MNO|GIJ105|208|801X002.03.05|X012.02.03|X012.03.01|X023.04.03
80​
Feb'21
123​
ABC|XYZ.|DEF|MNO101|108|205|225|171X001.01.02|X012.02.01|X018.01.05
100​
Feb'21

Thank you

Regards
Suresh
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

jasonb75

Well-known Member
Joined
Dec 30, 2008
Messages
13,504
Office Version
  1. 365
Platform
  1. Windows
With messy data come messy formulas.
Book1
ABCDEF
1IDCompany NameCodeActivityResultPeriod
2123ABC|XYZ.|DEF|MNO|QRS101|108|205|225|171X001.01.02|X012.02.01|X018.01.0590Jan'21
3456MNO|XYZ.|RVS225|229|105|101|201X001.01.02|X012.03.01|X019.02.03100Jan'21
4235ABC|QRS201|205|701X001.01.02|X012.04.01|X022.05.01|X123.01.05|X027.02.0385Jan'21
5456QRS|XYZ|MNO|GIJ105|208|801X002.03.05|X012.02.03|X012.03.01|X023.04.0380Feb'21
6123ABC|XYZ.|DEF|MNO101|108|205|225|171X001.01.02|X012.02.01|X018.01.05100Feb'21
7
8
9ID#456
10Company Name#MNO
11Code#105
12Activity#X012.03.01
13
14Average90
Sheet5
Cell Formulas
RangeFormula
B14B14=AVERAGE(IF(A2:A6=B9,IF(ISNUMBER(SEARCH("|"&B10&"|","|"&B2:B6&"|")),IF(ISNUMBER(SEARCH("|"&B11&"|","|"&C2:C6&"|")),IF(ISNUMBER(SEARCH("|"&B12&"|","|"&D2:D6&"|")),E2:E6)))))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Solution

suresh7860

New Member
Joined
Jul 18, 2015
Messages
48
T
With messy data come messy formulas.
Book1
ABCDEF
1IDCompany NameCodeActivityResultPeriod
2123ABC|XYZ.|DEF|MNO|QRS101|108|205|225|171X001.01.02|X012.02.01|X018.01.0590Jan'21
3456MNO|XYZ.|RVS225|229|105|101|201X001.01.02|X012.03.01|X019.02.03100Jan'21
4235ABC|QRS201|205|701X001.01.02|X012.04.01|X022.05.01|X123.01.05|X027.02.0385Jan'21
5456QRS|XYZ|MNO|GIJ105|208|801X002.03.05|X012.02.03|X012.03.01|X023.04.0380Feb'21
6123ABC|XYZ.|DEF|MNO101|108|205|225|171X001.01.02|X012.02.01|X018.01.05100Feb'21
7
8
9ID#456
10Company Name#MNO
11Code#105
12Activity#X012.03.01
13
14Average90
Sheet5
Cell Formulas
RangeFormula
B14B14=AVERAGE(IF(A2:A6=B9,IF(ISNUMBER(SEARCH("|"&B10&"|","|"&B2:B6&"|")),IF(ISNUMBER(SEARCH("|"&B11&"|","|"&C2:C6&"|")),IF(ISNUMBER(SEARCH("|"&B12&"|","|"&D2:D6&"|")),E2:E6)))))
Press CTRL+SHIFT+ENTER to enter array formulas.
Thank you Jason, its working with the example and will test the same with the real data and confirm back tomorrow :) Have a great weekend ahead!!
 

Forum statistics

Threads
1,140,917
Messages
5,703,167
Members
421,279
Latest member
emzy

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
Top