ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Adjusting a formula cell range (https://www.excelbanter.com/excel-discussion-misc-queries/90769-adjusting-formula-cell-range.html)

Jamie

Adjusting a formula cell range
 
I have a formula that uses cells D2:D20, the problem is the info that it is
using is updated through a query, so I might need the range to be D2:D30, if
I set the range to larger than what i need it causes an error in the formula,
is there a way to make excel recognize whether there is a value in the cell
or not and include it in the formula range so the formula range floats with
the data that arrives through the query.

Thanks

Daniel CHEN

Adjusting a formula cell range
 
Use the following to create a dynamic range:

OFFSET(D2,0,0,COUNT(D2:D99),1)

Replace D2:D20 in your formula with the above dynamic range.
99 can be changed to any big number.

--
Best regards,
---
Yongjun CHEN
=================================
XLDataSoft - Data Analysis Expert, Excel/VBA Specialist
- - - - www.XLDataSoft.com - - - -
Free Excel-Based Data Processing Tool is Available for Download
Free Excel / VBA Training Materials is Available for Download
=================================

"Jamie" wrote in message
...
I have a formula that uses cells D2:D20, the problem is the info that it is
using is updated through a query, so I might need the range to be D2:D30,
if
I set the range to larger than what i need it causes an error in the
formula,
is there a way to make excel recognize whether there is a value in the
cell
or not and include it in the formula range so the formula range floats
with
the data that arrives through the query.

Thanks





All times are GMT +1. The time now is 04:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com