Discussion Re: Prevent formula from changing range when cut and paste data in Excel
https://techcommunity.microsoft.com/t5/excel/prevent-formula-from-changing-range-when-cut-and-paste-data/m-p/2731881#M113172
<P><LI-USER uid="1149502"></LI-USER> </P><P>I am with your staff on this! Of course they will want to use Ctrl/X, Ctrl/V to move a booking from one room to another. The problem is not the users, it is the fragility of virtually all spreadsheet solutions.</P><P>In your case, I would place the entire dataset within a single named range 'beds'. The data for any given room 'roomNum' is determined by the stride length in rows between rooms (25 say) and the count of beds per room (20). The room data and occupancy level are then returned by</P><LI-CODE lang="excel-formula">= OFFSET(Beds,25*(roomNum-1),0,20,1)
= COUNTA(OFFSET(Beds,25*(roomNum-1),0,20,1))</LI-CODE><P> It doesn't help right now, but something called Lambda functions are now on beta release that will allow you to define a function to return the occupancy for any given room, e.g.</P><LI-CODE lang="excel-formula">= OCCUPIED("Room2")
= COUNTA(OCCUPIED("Room2"))</LI-CODE><P>In this 'glammed-up' version, the room data and bed count could be returned by XLOOKUP from a pre-defined table that describes the data layout.</P><P> </P>Wed, 08 Sep 2021 09:37:17 GMTPeter Bartholomew2021-09-08T09:37:17ZPrevent formula from changing range when cut and paste data
https://techcommunity.microsoft.com/t5/excel/prevent-formula-from-changing-range-when-cut-and-paste-data/m-p/2731038#M113145
<P>I have a workbook on a shared drive that about 10 people access and need to change specific data. In the workbook I have a range of cells representing beds in rooms. 5 rooms, 20 beds each, arranged in a column with space between each group. Each cell represents one bed and either has a name or it doesn't. At the end of the range is a formula that checks how many cells have names and outputs a number giving a total number of occupied beds. It looks like this:</P><P> </P><P>=SUM(--ISTEXT($C$63:$C$82))</P><P> </P><P>The problem is, If a user cuts a name from one room and pastes it into a cell of another room, the formula wants to include all the cells from the point of origin to the new cell. I've since learned this is a feature and desired by many users. I am not one of them. My own knowledge of excel is sketchy and the rest of the people that need to use this workbook are not very computer friendly as it is. They will definitely cut and paste no matter how many emails I send out asking to copy and paste. Is there any way to lock that formula and make this workbook idiot proof? Or is there a different way to write that formula so it is only concerned with whether or not there is data in the cell and not the actual data itself?</P>Wed, 08 Sep 2021 04:06:28 GMThttps://techcommunity.microsoft.com/t5/excel/prevent-formula-from-changing-range-when-cut-and-paste-data/m-p/2731038#M113145Daktal2021-09-08T04:06:28ZRe: Prevent formula from changing range when cut and paste data
https://techcommunity.microsoft.com/t5/excel/prevent-formula-from-changing-range-when-cut-and-paste-data/m-p/2731643#M113162
<P><LI-USER uid="1149502"></LI-USER> </P>
<P>You might use the INDIRECT function:</P>
<P> </P>
<P>=SUM(--ISTEXT(INDIRECT("C63:C82")))</P>
<P> </P>
<P>or</P>
<P> </P>
<P>=COUNTA(INDIRECT("C63:C82"))</P>Wed, 08 Sep 2021 07:43:14 GMThttps://techcommunity.microsoft.com/t5/excel/prevent-formula-from-changing-range-when-cut-and-paste-data/m-p/2731643#M113162Hans Vogelaar2021-09-08T07:43:14ZRe: Prevent formula from changing range when cut and paste data
https://techcommunity.microsoft.com/t5/excel/prevent-formula-from-changing-range-when-cut-and-paste-data/m-p/2731689#M113166
<P><LI-USER uid="127945"></LI-USER> </P><P> </P><P>Thank you! After some googling, I figured the INDIRECT tag was going to be the key, but I couldn't for the life of me get the syntax down properly. I just tried it for one formula and it worked the way I need it to. I'll try it on the rest and put it in production and see how it works. But, it looks like this is the answer. Thank you very much.</P>Wed, 08 Sep 2021 07:57:29 GMThttps://techcommunity.microsoft.com/t5/excel/prevent-formula-from-changing-range-when-cut-and-paste-data/m-p/2731689#M113166Daktal2021-09-08T07:57:29ZRe: Prevent formula from changing range when cut and paste data
https://techcommunity.microsoft.com/t5/excel/prevent-formula-from-changing-range-when-cut-and-paste-data/m-p/2731881#M113172
<P><LI-USER uid="1149502"></LI-USER> </P><P>I am with your staff on this! Of course they will want to use Ctrl/X, Ctrl/V to move a booking from one room to another. The problem is not the users, it is the fragility of virtually all spreadsheet solutions.</P><P>In your case, I would place the entire dataset within a single named range 'beds'. The data for any given room 'roomNum' is determined by the stride length in rows between rooms (25 say) and the count of beds per room (20). The room data and occupancy level are then returned by</P><LI-CODE lang="excel-formula">= OFFSET(Beds,25*(roomNum-1),0,20,1)
= COUNTA(OFFSET(Beds,25*(roomNum-1),0,20,1))</LI-CODE><P> It doesn't help right now, but something called Lambda functions are now on beta release that will allow you to define a function to return the occupancy for any given room, e.g.</P><LI-CODE lang="excel-formula">= OCCUPIED("Room2")
= COUNTA(OCCUPIED("Room2"))</LI-CODE><P>In this 'glammed-up' version, the room data and bed count could be returned by XLOOKUP from a pre-defined table that describes the data layout.</P><P> </P>Wed, 08 Sep 2021 09:37:17 GMThttps://techcommunity.microsoft.com/t5/excel/prevent-formula-from-changing-range-when-cut-and-paste-data/m-p/2731881#M113172Peter Bartholomew2021-09-08T09:37:17Z