4D Blog

Home Product Name your ranges and formulas in 4D View Pro

Name your ranges and formulas in 4D View Pro

February 19, 2019

Product

4D v17 R4 is on the way with a cool new 4D View Pro feature: named ranges and formulas. If you need to use formulas with references to cell(s) or constant(s), this feature can be a great help!

With these new commands, your formulas are more readable and easily accessible with 4D View Pro’s automatic completion.

You can now create two types of names by programming: one referring to a range of cells, and another referring to a formula.

named ranges

A named range is a human-readable label for a range of cell(s). You can easily apply a readable name with code to the cells you’re interested in with VP ADD RANGE NAME.

For example, in this document:

You can create a named range for each “sales” cell:

// name the B2 cell as Pears_Sales
VP ADD RANGE NAME (VP Cell ("ViewProArea";1;1);"Sales_Pears")
// name the B3 cell as Oranges_Sales
VP ADD RANGE NAME (VP Cell ("ViewProArea";1;2);"Sales_Oranges")
// name the B4 cell as Cherries_Sales
VP ADD RANGE NAME (VP Cell ("ViewProArea";1;3);"Sales_Cherries")
// name the B5 cell as Grapes_Sales
VP ADD RANGE NAME (VP Cell ("ViewProArea";1;4);"Sales_Grapes")

Then, you can use the named ranges in your formulas via automatic completion. They will appear automatically when you type the first letter of the name:

blank

named formulas

You can use VP ADD FORMULA NAME to replace calculations with readable names in your spreadsheets:

// Create a Sales total
VP ADD FORMULA NAME("ViewProArea";"SUM($B$2:$B$5)";"Sales_Total")

blank

The same VP ADD FORMULA NAME command can be used to create a constant and make the calculations in your spreadsheet easier:

// Create a constant
VP ADD FORMULA NAME("ViewProArea";"=1.1";"Tax")

The spreadsheet shows a simple, readable formula:

blank

and more

As we mentioned earlier, these names can be quite useful and as a bonus, you can directly use these names in your code with the VP Name command:

VP SET NUM VALUE(VP Name("ViewProArea";"Sales_Grapes");285;"$#,###.00")

The two new commands allow you to manage your existing names:

  • With the VP Get formula by name command, verify if a name already exists and get the formula assigned to it.
  • With VP Get names command, get a list of all names created for a given scope.

 

 

Discuss

Tags 4D View Pro, Spreadsheet, v17 R4, v18

Latest related posts

  • May 20, 2025

    Automatic Refresh of OEM Build Licenses

  • May 16, 2025

    New class to handle incoming TCP connections

  • April 29, 2025

    Discover your AI-powered writing assistant in 4D Write Pro

Fabrice Mainguené
Fabrice Mainguené
• Product Owner •Fabrice Mainguené joined 4D Program team in November, 2016. As a Product Owner, he is in charge of writing the user stories then translating it to functional specifications. His role is also to make sure that the feature implementation delivered is meeting the customer need.After obtaining a Bachelor degree in Computer Science at CNAM, Fabrice joined a small software publishing company as a Windev developer. Then he worked for different companies in industry and trade areas as a Windev and web developer as well as technical advisor on new features.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor
Subscribe to 4D Newsletter

© 2025 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy