Count how many times a cell is referenced in a table of ranges

mcharg

New Member
Joined
Jul 20, 2020
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi there! I am looking to count the number of times a cell in the ‘Plot Table’ is referenced by a range listed in the ‘Range Table’. The example in the attached image gives an example of what I am trying to achieve. As there will potentially be a large number of ranges in the ‘Range Table’ I am looking for a scalable formula to go in the Plot Table that will work for a large number of ranges. I am a bit stuck as to how to make this work so any assistance would be greatly appreciated. Let me know if more detail is required.

Thanks!
 

Attachments

  • Range Table.JPG
    Range Table.JPG
    77.5 KB · Views: 8

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Can't give you a formula, but here's a VBA solution to do the plotting and get the answer.

VBA Code:
Sub plot()

Dim sht As Worksheet
Dim LastRow As Long
Dim rownum As Long
Dim plotrow As Long
Dim plotcol As Long

Set sht = ActiveSheet
rownum = 18
LastRow = sht.Cells(sht.Rows.Count, "B").End(xlUp).Row

Do Until rownum = LastRow + 1
plotrow = 3
    Do Until plotrow = 13
    plotcol = 2
        Do Until plotcol = 12
            If Cells(plotrow, 1) >= Cells(rownum, 4) And Cells(plotrow, 1) <= Cells(rownum, 5) And Cells(2, plotcol) >= Cells(rownum, 2) And Cells(2, plotcol) <= Cells(rownum, 3) Then
            Cells(plotrow, plotcol) = Cells(plotrow, plotcol) + 1
            End If
        plotcol = plotcol + 1
        Loop
    plotrow = plotrow + 1
    Loop
rownum = rownum + 1
Loop

End Sub
 
Upvote 0
Thank you! This works great! I was hoping to do the same with a formula though, as this may be slow with a large data set.
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,520
Members
448,968
Latest member
Ajax40

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