SOLVED

discontinuous selection

%3CLINGO-SUB%20id%3D%22lingo-sub-1300357%22%20slang%3D%22en-US%22%3Ediscontinuous%20selection%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1300357%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20is%20driving%20me%20a%20bit%20crazy.%20How%20do%20I%20make%20a%20discontinuous%20selection%20that%20I%20can%20copy%20into%20multiple%20rows.%20Here%20is%20what%20I%20want%20to%20do%2C%20and%20what%20I%20tried%20so%20far%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Screenshot%202020-04-11%2014.59.24.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F183750i287CDB2406911F1D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Screenshot%202020-04-11%2014.59.24.png%22%20alt%3D%22Screenshot%202020-04-11%2014.59.24.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EBasically%2C%20I%20want%20to%20enter%20a%20dollar%20amount%20in%20the%20%22Tip%20Pool%22%20column%20and%20then%20I%20want%20to%20be%20able%20to%20put%20a%20%22x%22%20on%20the%20left%20side%20of%20each%20person%20who%20should%20get%20a%20portion%20of%20that%20amount.%3C%2FP%3E%3CP%3EIn%20the%20%22ppl%22%20column%20(G)%20I%20therefore%20need%20to%20count%20how%20many%20%22x%22%20there%20are%20in%20this%20row%2C%20so%20that%20the%20columns%20for%20each%20person%20(I%2CK%2CM%2CO%2C...)%20then%20can%20divide%20the%20%22Tip%20Pool%22%20by%20the%20number%20of%20people%20participating.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOriginally%20I%20tried%20to%20just%20put%20a%20%3DCOUNTIF(H3%3AZ3%2C%22x%22)%20into%20the%20ppl%20cell%2C%20but%20when%20I%20then%20refer%20to%20that%20cell%20in%20the%20calculation%20of%20cell%20I3%2C%20Excel%20complains%20about%20a%20circular%20reference%2C%20because%20I3%20is%20in%20the%20H3%3AZ3%20range.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESO%3A%20I%20need%20to%20use%20a%20discontinuous%20range%20in%20G3.%20You%20can%20see%20the%20formula%20that%20works%20for%20this%20in%20the%20formula%20bar%20up%20top%2C%20but%20because%20that%20formula%20uses%20hard-coded%20references%2C%20when%20I%20now%20copy%20that%20formula%20into%20the%20cell%20range%20G4%3AG2000%20(I%20need%20a%20lot%20of%20rows)%20it%20uses%20the%20hard-coded%20references%20and%20does%20not%20increase%20the%20line%20number%3B%20so%20you%20can%20see%20that%20cells%20G4%2C%20G5%2C%20etc.%20also%20count%20the%20%22x%22-es%20in%20row%203%2C%20rather%20than%20their%20own%20row%20%3CLI-EMOJI%20id%3D%22lia_disappointed-face%22%20title%3D%22%3Adisappointed_face%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FP%3E%3CP%3ESo%3A%20I%20tried%20starting%20out%20with%20something%20like%3A%26nbsp%3B%3DSUM(COUNTIF(INDIRECT(%7B%22H%22%26amp%3BROW(A3)%2C...%3CBR%20%2F%3EBUT%20Excel%20does%20not%20seem%20to%20allow%20a%20formula%20and%20cell%20reference%20inside%20the%20%22%7B%22%20in%20the%20INDIRECT%20function.%3C%2FP%3E%3CP%3ESo%20I%20can't%20torn%20the%20list%20%22H3%22%2C%22J3%22%2C...%26nbsp%3B%20into%20a%20list%20where%20the%20%223%22%20is%20a%20relative%20number%2C%20denoting%20the%20current%20line.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20driving%20me%20crazy!%20It%20doesn't%20seem%20that%20what%20I%20want%20to%20do%20is%20that%20unusual.%20How%20can%20I%20make%20it%20so%20my%20employees%2C%20who%20aren't%20well-versed%20in%20excel%20(or%20math)%20van%20simply%20enter%20a%20total%20amount%20in%20a%20row%2C%20then%20check%20of%20who%20should%20get%20a%20share%20of%20the%20amount%20and%20have%20excel%20put%20in%20the%20correct%20number%20for%20each%20person--and%20do%20it%20in%20a%20single%20row%2C%20so%20I%20can%20have%202000%20rows%20ready%20for%20them%20to%20do%20the%20same%20thing%20(and%20keep%20a%20historical%20record)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20any%20tips!%20(no%20pun%20intended)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1300357%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%20on%20Mac%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1300542%22%20slang%3D%22en-US%22%3ERe%3A%20discontinuous%20selection%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1300542%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F618116%22%20target%3D%22_blank%22%3E%40markusbohu%3C%2FA%3E%26nbsp%3BThe%20circular%20reference%20warning%20comes%20up%20because%20the%20simple%20COUNTIF%20formula%20that%20would%20calculate%20pay-out%2C%20sits%20within%20the%20range%20that%20the%20formula%20is%20addressing.%20But%2C%20in%20this%20case%20the%20pay-out%20will%20never%20affect%20the%20outcome%20of%20the%20COUNTIF%2C%20so%20you%20need%20to%20tell%20Excel%20that%20it%20should%20use%20iterative%20calculation.%20You'll%20find%20it%20under%20Excel%2C%20Preferences...%2C%20Formulas%20and%20Lists%2C%20Calculation.%20Tick%20the%20box%20and%20leave%20the%20other%20settings%20as%20they%20are.%20Now%20everything%20will%20work%20as%20you%20want%20it%20to.%20Have%20tested%20it%20with%20the%20attached%20workbook.%20Note%20that%20the%20COUNTIF%20can%20be%20written%20so%20that%20it%20looks%20at%20the%20entire%20row.%20That%20way%2C%20you%20can%20add%20people%20without%20ever%20having%20to%20expand%20the%20range.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202020-04-12%20at%2007.07.14.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F183761iD4CC41043F1B53A9%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Screenshot%202020-04-12%20at%2007.07.14.png%22%20alt%3D%22Screenshot%202020-04-12%20at%2007.07.14.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1301207%22%20slang%3D%22en-US%22%3ERe%3A%20discontinuous%20selection%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1301207%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3BThank%20you.%20That%20is%20a%20much%20simpler%20solution%20than%20the%20one%20I%20came%20up%20with.%20The%20only%20disadvantage%20is%20that%20it%20depends%20on%20a%20global%20setting%2C%20which%20does%20not%20save%20with%20the%20excel%20file%20itself%2C%20so%20I%20wonder%20what%20happens%20when%20the%20file%20gets%20opened%20on%20a%20computer%20where%20this%20setting%20has%20not%20been%20adjusted.%3CBR%20%2F%3EYesterday%20I%20came%20up%20with%20a%20MUCH%20more%20complicated%20solution%3A%3CBR%20%2F%3EI%20simplified%20the%20countif%20formula%20to%3A%26nbsp%3B%3DSUM(COUNTIF(INDIRECT(BC3%3ABY3)%2C%22x%22))%3CBR%20%2F%3EI%20put%20ROW(%24A3)%20in%20BB3%2C%20put%20numbers%20that%20increase%20by%202%20in%20line%202%20(starting%20with%20the%20ascii%20code%20of%20the%20letter%20of%20the%20first%20column%20with%20%22x%22%3C%2FP%3E%3CP%3Eand%20in%20the%20BC3%3ABY3%20range%20I%20put%20in%20something%20like%3A%26nbsp%3B%3DCHAR(BL%242)%26amp%3B%24BB3%20(and%26nbsp%3B%3D%22A%22%26amp%3BCHAR(BM%242)%26amp%3B%24BB3)%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22markusbohu_1-1586709151970.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F183814i73E4E7A8E7789807%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22markusbohu_1-1586709151970.png%22%20alt%3D%22markusbohu_1-1586709151970.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThen%20I%20hid%20the%20entire%20BB%20to%20BY%20column%20range%20and%20protected%20the%20sheet.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20works%2C%20but%20does%20not%20have%20the%20additional%20advantage%20of%20being%20able%20to%20easily%20add%20more%20employees%2C%20so%20I%20had%20to%20make%20sure%20I%20had%20plenty%20of%20columns%20available%20for%20them.%20My%20intention%20is%20to%20then%20hide%20the%20columns%20for%20each%20inactive%20or%20terminated%20employee%2C%20so%20they%20don't%20have%20to%20scroll.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

This is driving me a bit crazy. How do I make a discontinuous selection that I can copy into multiple rows. Here is what I want to do, and what I tried so far:

Screenshot 2020-04-11 14.59.24.png

Basically, I want to enter a dollar amount in the "Tip Pool" column and then I want to be able to put a "x" on the left side of each person who should get a portion of that amount.

In the "ppl" column (G) I therefore need to count how many "x" there are in this row, so that the columns for each person (I,K,M,O,...) then can divide the "Tip Pool" by the number of people participating.

 

Originally I tried to just put a =COUNTIF(H3:Z3,"x") into the ppl cell, but when I then refer to that cell in the calculation of cell I3, Excel complains about a circular reference, because I3 is in the H3:Z3 range.

 

SO: I need to use a discontinuous range in G3. You can see the formula that works for this in the formula bar up top, but because that formula uses hard-coded references, when I now copy that formula into the cell range G4:G2000 (I need a lot of rows) it uses the hard-coded references and does not increase the line number; so you can see that cells G4, G5, etc. also count the "x"-es in row 3, rather than their own row

So: I tried starting out with something like: =SUM(COUNTIF(INDIRECT({"H"&ROW(A3),...
BUT Excel does not seem to allow a formula and cell reference inside the "{" in the INDIRECT function.

So I can't turn the list "H3","J3",...  into a list where the "3" is a relative number, denoting the current line.

 

This is driving me crazy! It doesn't seem that what I want to do is that unusual. How can I make it so my employees, who aren't well-versed in excel (or math) can simply enter a total amount in a row, then check of who should get a share of the amount and have excel put in the correct number for each person--and do it in a single row, so I can have 2000 rows ready for them to do the same thing (and keep a historical record)

 

Thanks for any tips! (no pun intended)

2 Replies
Highlighted
Best Response confirmed by markusbohu (New Contributor)
Solution

@markusbohu The circular reference warning comes up because the simple COUNTIF formula that would calculate pay-out, sits within the range that the formula is addressing. But, in this case the pay-out will never affect the outcome of the COUNTIF, so you need to tell Excel that it should use iterative calculation. You'll find it under Excel, Preferences..., Formulas and Lists, Calculation. Tick the box and leave the other settings as they are. Now everything will work as you want it to. Have tested it with the attached workbook. Note that the COUNTIF can be written so that it looks at the entire row. That way, you can add people without ever having to expand the range.

 

Screenshot 2020-04-12 at 07.07.14.png

 

Highlighted

@Riny_van_Eekelen Thank you. That is a much simpler solution than the one I came up with. The only disadvantage is that it depends on a global setting, which does not save with the excel file itself, so I wonder what happens when the file gets opened on a computer where this setting has not been adjusted.
Yesterday I came up with a MUCH more complicated solution:
I simplified the countif formula to: =SUM(COUNTIF(INDIRECT(BC3:BY3),"x"))
I put ROW($A3) in BB3, put numbers that increase by 2 in line 2 (starting with the ascii code of the letter of the first column with "x"

and in the BC3:BY3 range I put in something like: =CHAR(BL$2)&$BB3 (and ="A"&CHAR(BM$2)&$BB3)

markusbohu_1-1586709151970.png

 

Then I hid the entire BB to BY column range and protected the sheet.

 

It works, but does not have the additional advantage of being able to easily add more employees, so I had to make sure I had plenty of columns available for them. My intention is to then hide the columns for each inactive or terminated employee, so they don't have to scroll.