Reference Cell Contents in Range Formula

jski21

Board Regular
Joined
Jan 2, 2019
Messages
141
Office Version
  1. 2016
Platform
  1. Windows
Good day Mr. Excel Team,

Seeking some expert wisdom here. I have a pivot table that is dynamic in range dependent upon what criteria I select. I have a SMALL function formula that then looks into the range to find the bottom 5 observations according to their value:

="1. "&INDEX(Pivots!$A$4:$A$14,MATCH(SMALL(Pivots!$C$4:$C$14,ROWS($B15:$B$15)),Pivots!$C$4:$C$14,0))

Everything works fine except that I find myself having to manually change the end of the range (red 14 above) in each of the five formulas to accommodate the dynamic range of the pivot table. I did find a way to determine the number of the last row of data using the formula =ROW(OFFSET(A1,COUNTA(A:A),0)) and have this in a cell (in this case, "14").

I'm struggling with finding a way to create a formula to accommodate the ROW, OFFSET result into the SMALL function formula so that I don't have to manually change the Pivots! range reference.

Hopefully this is not as unique of a request as I think it is and the Mr. Excel Team can offer a solution.

Thanks in advance for the review, consideration, and assistance.


jski
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hi

You may us the indirect formula to integrate both


="1."&INDEX(Pivots!$A$4:indirect("$A$"&ROW(OFFSET(A1,COUNTA(A:A),0))),MATCH(SMALL(Pivots!$C$4:indirect("$C$"&ROW(OFFSET(A1,COUNTA(A:A),0))),ROWS($B15:$B$15)),Pivots!$C$4:indirect("$C$"&ROW(OFFSET(A1,COUNTA(A:A),0))),0))
 
Upvote 0
Thanks for the response. Interesting approach but I'm receiving a #VALUE error when I plug it in. Might you be open to taking a look at a sample file? I'm probably over looking something minor.
 
Upvote 0
Hi

Can you pls share a sample of the excel sheet

Thanks

Here's a snapshot. Cell B15 is my original formula. Cell C24 is where I'm attempting your version. I can send you the sample file if you'd like. Just message me with your email. Thank Arun!

Cell Formulas
RangeFormula
B8B8="1. "&INDEX(Pivots!$A$4:$A$30,MATCH(LARGE(Pivots!$C$4:$C$30,ROWS($B$8:$B$8)),Pivots!$C$4:$C$30,0))
B9B9="2. "&INDEX(Pivots!$A$4:$A$30,MATCH(LARGE(Pivots!$C$4:$C$30,ROWS($B$8:$B$9)),Pivots!$C$4:$C$30,0))
B10B10="3. "&INDEX(Pivots!$A$4:$A$30,MATCH(LARGE(Pivots!$C$4:$C$30,ROWS($B$8:$B$10)),Pivots!$C$4:$C$30,0))
B11B11="4. "&INDEX(Pivots!$A$4:$A$30,MATCH(LARGE(Pivots!$C$4:$C$30,ROWS($B$8:$B$11)),Pivots!$C$4:$C$30,0))
B12B12="5. "&INDEX(Pivots!$A$4:$A$30,MATCH(LARGE(Pivots!$C$4:$C$30,ROWS($B$8:$B$12)),Pivots!$C$4:$C$30,0))
G8:G12G8=LARGE(Pivots!$A$4:$B$14,ROWS($B$8:$B8))
B15B15="1. "&INDEX(Pivots!$A$4:$A$14,MATCH(SMALL(Pivots!$C$4:$C$14,ROWS($B15:$B$15)),Pivots!$C$4:$C$14,0))
B16B16="2. "&INDEX(Pivots!$A$4:$A$14,MATCH(SMALL(Pivots!$C$4:$C$14,ROWS($B15:$B$16)),Pivots!$C$4:$C$14,0))
B17B17="3. "&INDEX(Pivots!$A$4:$A$14,MATCH(SMALL(Pivots!$C$4:$C$14,ROWS($B15:$B$17)),Pivots!$C$4:$C$14,0))
B18B18="4. "&INDEX(Pivots!$A$4:$A$14,MATCH(SMALL(Pivots!$C$4:$C$14,ROWS($B15:$B$18)),Pivots!$C$4:$C$14,0))
B19B19="5. "&INDEX(Pivots!$A$4:$A$14,MATCH(SMALL(Pivots!$C$4:$C$14,ROWS($B15:$B$19)),Pivots!$C$4:$C$14,0))
G15G15=SMALL(Pivots!$A$4:$B$14,ROWS($B15:$B$15))
G16G16=SMALL(Pivots!$A$4:$B$14,ROWS($B15:$B$16))
G17G17=SMALL(Pivots!$A$4:$B$14,ROWS($B15:$B$17))
G18G18=SMALL(Pivots!$A$4:$B$14,ROWS($B15:$B$18))
G19G19=SMALL(Pivots!$A$4:$B$14,ROWS($B15:$B$19))
C24C24="1."&INDEX(Pivots!$A$4:INDIRECT("$A$"&ROW(OFFSET(Pivots!A1,COUNTA(Pivots!A:A),0))),MATCH(SMALL(Pivots!$C$4:INDIRECT("$C$"&ROW(OFFSET(Pivots!A1,COUNTA(Pivots!A:A),0))),ROWS($B15:$B$15)),Pivots!$C$4:INDIRECT("$C$"&ROW(OFFSET(Pivots!A1,COUNTA(Pivots!A:A),0))),0))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B19Cell ValueduplicatestextNO
B12Cell ValueduplicatestextNO
B8:B11Cell ValueduplicatestextNO
B15:B18Cell ValueduplicatestextNO
 
Upvote 0
Good day,,

Here is an XL2BB snapshot of the Pivots sheet:

Sample File.xlsx
ABCDEFGHIJKLM
1Type of Activity(Multiple Items)Type of Activity(Multiple Items)15
2
3ProjectIndividual Commitment Adjust for DupesYearAmountTypeAmount
4CLE Restoration Society - Heritage Home Prgm 46,000.0046,000.00201945,000CDC1,929,334.18
5Greater CLE Volunteers - AARP Fdn Literacy Tutoring1,000.001,000.002020690,000CW46,000.00
6Harvard Comm. Svcs. Ctr. - CDC Activity Grant1,056,172.411,056,172.412021421,626SS90,928.35
7Union Miles Dev. Corp. - CDC Activity Grant114,771.55114,771.552022527,812PS1,984.96
8Famicos Foundation - CDC Activity Grant757,336.38757,336.382023500,000Planning40,000.00
9Comm. Neighborhood Organizer - Harvard Comm. Svcs. Ctr.40,000.0040,000.00Grand Total2,184,438Str. Imprvmnt76,190.00
10Bryce Avenue Street Resurfacing76,190.0076,190.00Grand Total2,184,437.49
11Center for Arts - Inspired Learning: ArtWorks1,984.961,984.96
12First Street Coalition - Mt. Pleasant INFO Magazine9,000.009,000.00
13Mount Pleasant NOW - CDC Activity Grant1,053.841,053.84
14Ohio City/Near West Recreation (Swap with Mayor's Office)49,506.3949,506.39
15Harvard Comm. Svcs. Ctr. - Beautification and Litter Clean-up31,421.9631,421.96
16(0.02)
17(0.02)
18(0.02)
19(0.02)
20(0.02)
21(0.02)
22(0.02)
23(0.02)
24(0.02)
25(0.02)
26(0.02)
27(0.02)
28(0.02)
29(0.02)
30(0.02)
Pivots
Cell Formulas
RangeFormula
L1L1=ROW(OFFSET(A1,COUNTA(A:A),0))
C4:C30C4=B4+(COUNTIF($B$4:B4,B4)-1)*0.015


I'm not seeing an option to upload a file on this platform. If the sample file would be useful, please provide your email address and I can send it.

Thanks!
 
Upvote 0
Hi

Since the reference is to the 'Pivots' sheet, the formula will have to be modified as below

="1."&INDEX(Pivots!$A$4:INDIRECT("Pivots!$A$"&ROW(OFFSET(Pivots!A1,COUNTA(Pivots!A:A),0))),MATCH(SMALL(Pivots!$C$4:INDIRECT("Pivots!$C$"&ROW(OFFSET(Pivots!A1,COUNTA(Pivots!A:A),1))),ROWS($B15:$B$15)),Pivots!$C$4:INDIRECT("Pivots!$C$"&ROW(OFFSET(Pivots!A1,COUNTA(Pivots!A:A),0))),0))
 
Upvote 1
Outstanding Arun. Thanks so much for your time and assist with this. Huge time saver for me and very instructive as well!


jski
 
Upvote 0

Forum statistics

Threads
1,217,389
Messages
6,136,317
Members
450,003
Latest member
AnnetteP

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