Named range in cell reference

KGee

Well-known Member
Joined
Nov 26, 2008
Messages
537
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
This should be simple but I can't get the right syntax. I need to figure out the last row in column B and parse a string value from the text in that cell. I created a named range (dcLastRow) to return the last row (132 in current report) and want to use that named range within my cell formula. I've tried different variations of the syntax below but nothing is returned or I get a #name error.
Code:
=MID("B" & dcLastRow,6,3)
 
=MID(INDEX(B:B, dcLastRow, 1), 6,3) is less volatile than the INDIRECT approach.
 
Last edited:
Upvote 0

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Thanks so much guys. These all worked. I need to extract additional values from that cell but now that I have the key I can take it from here. What is the difference, if any, from the two formulas below?
Code:
[COLOR=#333333]=MID(INDEX(B:B,dcLastRow),6,3)
[/COLOR][COLOR=#333333]=MID(INDEX(B:B,dcLastRow,1),6,3)[/COLOR]


 
Upvote 0
The first one uses the default 1 as the second argument. I prefer explicitly declaring optional defaults, as in the second.
 
Upvote 0

Forum statistics

Threads
1,221,418
Messages
6,159,790
Members
451,589
Latest member
Harold14

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