Formula linked to dynamic range of spilled range

ajocius1

Board Regular
Joined
Dec 21, 2007
Messages
111
Office Version
  1. 365
Platform
  1. Windows
Hi, I have UNIQUE formula returning relevant records from data source table. Result is obviously dynamic depending on source data. I have list of unique vendor names and added formulas to count orders that looks for vendor name in result of Unique formula and then using CountA formula. List of unique vendor names will change over time, list will either reduce or get longer. I would like to match my count formula to the dynamic list of vendors. Any way to do it smart instead of verifying formulas I get new data?
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
You can refer to the 1st cell in a spill range like A2#
 
Upvote 0
Book1
AB
1NameCount
2John5
3Steve4
4Joshua6
57
Sheet1


Here is example of what I try to do. List in column A is result of UNIQUE formula and has spill range. It is dynamic, so when more data is loaded it will expand. I have then COUNTA formula in column B. I would like column B to be also dynamic, linked to number of records in column A
 
Upvote 0
Tried to get around with VBA code:

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$A$2" Then
            Range("B6:B99999").Clear
            Range("B6:B" & A4 + 5).Formula2R1C1 = "=COUNTA(FILTER(Table2[Name],Table2[Name]=RC[-1]))"
    End If
End Sub

My worksheet has formula, so the value of that cell with formula changes, however it does not trigger above macro
 
Upvote 0
Tried to get around with VBA code:

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$A$2" Then
            Range("B6:B99999").Clear
            Range("B6:B" & A4 + 5).Formula2R1C1 = "=COUNTA(FILTER(Table2[Name],Table2[Name]=RC[-1]))"
    End If
End Sub

My worksheet has formula, so the value of that cell with formula changes, however it does not trigger above macro
Solved by moving above macro to the sheet where I actually make a change, which triggers formula calculation, so now it works. However, if there is smart way of achieving this without macro, would be great to hear.
 
Upvote 0
You just need to refer to the spill range as I showed in post#2
Excel Formula:
=COUNTIFS(Table2[Name],A2#)
 
Upvote 0

Forum statistics

Threads
1,214,385
Messages
6,119,208
Members
448,874
Latest member
b1step2far

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