Lookup or better method.

nparsons75

Well-known Member
Joined
Sep 23, 2013
Messages
1,256
Office Version
  1. 2016
Hi,

I have 2 worksheets, WS1 and WS2.

In WS1 I have a table and in Column A is a reference number (unique). Currently 1 to 15.

In WS2 I also have a table with multiple rows. In each row is a reference to a unique ref number in WS1.

For example, Ref 1 may have multiple rows in WS2 that refer to the unique ref number 1. (Column B, WS2)

In Column G of WS2 there is a value between 0 and 100.

In Column F of WS1 there is also a value between 0 and 100.

This is what I need to happen.

I need WS1 (column A) to look at WS2 (Column B) and find all the rows that refer to the same unique ref number. As an example there may be 3 rows that contain ref number 1.

Then, I need the total of all the values in Column B of WS2 to be added together and divided by the number of rows that the unique ref is found in, (in this case 3). The result will then be displayed in Column F of worksheet 1.

Hope that makes some sense....Thank you.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Try this one or share your data in table format!

Code:
=SUMIF($B$1:$B$17,'WS1'!A1)/COUNTIF($B$1:$B$17,'WS1'!A1)

1 1.00 1
1 2.00 2
2 3.00 3
2#DIV/0!4
2 5.00 5
2#DIV/0!6
3#DIV/0!7
3#DIV/0!8
3#DIV/0!9
3#DIV/0!10
3#DIV/0!11
5#DIV/0!12
5#DIV/0!13
5#DIV/0!14
5#DIV/0!15
5#DIV/0!16
5#DIV/0!17
#DIV/0!18




<colgroup><col width="64" span="6" style="width:48pt"> </colgroup><tbody>
</tbody>
 
Upvote 0
Thanks Muhammad, I managed to get a fix for this, thanks for your help.

I used: =IFERROR(SUMIF('WS2'!$B$19:$B$26,A18,'WS2'!$G$19:$G$26)/COUNTIF('WS2'!$B$19:$B$26,A18),0)
 
Upvote 0

Forum statistics

Threads
1,217,400
Messages
6,136,402
Members
450,009
Latest member
Office_Drone

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