Mysterious calculation issue & lettercase issue

Skrej

Board Regular
Joined
May 31, 2013
Messages
176
Office Version
  1. 365
Platform
  1. Windows
I have an attendance sheet on a shared drive we use for classroom attendance. We've had this same sheet for several years now, and it works as intended.

Leftmost column has student names, with subsequent columns to the right marked with attendance codes of 'P', 'A', or 'E'. On top of each of those columns is a date. The rightmost column tallies all the 'p' count with the simple formula (copied down) of "

Excel Formula:
=COUNTIF(D7:V7, "P")*2

This has been working just fine for a few years. However, yesterday I encountered a strange issue. I noticed that the tally count was one less than the number of 'p'. The tally count was consistently one off for every row.

While trying to troubleshoot, I noticed that one column (happened to be Mar. 7th, but I don't think that's relevant) wouldn't let me change the attendance code. I was working through adding extra 'p's to watch the tally count, and noticed that for that one particular column, when I typed a lowercase p over the uppercase P, it just kind of blinked and stayed uppercase. The forumula isn't case sensitive, and the only reason I was overwriting with lowercase 'p' was to keep track of my troubleshooting.

Sure enough, that entire column wouldn't update. I tested by trying to add lowercase p's below the last row with an actual student name - same deal. I typed lowercase, it automatically updated to uppercase, but tally count wouldn't update. So, I surmised that the tally problem wasn't reading the uppercase P in that column only. No idea why.

Here's where it gets even weirder. I accidentally discovered that if I continued adding lowercase 'p' the next row under, working DOWN, it did the auto-uppercase thing with no tally count. (At this point, I'm dealing with otherwise blank rows). However, if I skipped down several rows, and started working m;y way back UP the column, it would not only accept the lowercase 'p', but would then add one to the tally column as it should. If I continued working my way UP the column, it would then let me overwrite with lowercase, and the tally count updated!

I then tested a bit more, and replaced the lowercase P's in that column with uppercase, and things were back to normal. I could use uppper or lowercase letters as I wanted, and the tally would update. I tested a bit by changing some of the 'p' codes to 'A' or 'E', and back to uppercase P, and the tallies subsequently updated as expected. Saved it, closed it, re-opened it, and it was still working normally.

We have multiple copies of that sheet, one for each month within the workbook. I checked previous and future months, and the error did not appear on other sheets. We have multiple copies of that workbook, each identical except for the student and teacher names. Each instructor has three copies of the workbook, one for each individual class - all identical, as they're simply made from one master, then renamed with unique class name. The only difference is the student and teacher names, and of course individual student attendance codes.

I checked all other versions of that workbook for all other classes (all are stored on a shared drive), and found no other instances of the odd issue in March or any other month. It was unique to that one teacher's single class, on that one single month on that one single column. That suggests that it wasn't something in the layout or formulas, or else it would have been duplicated with all the copies from the original master.

The sheet is locked and protected so that individual instructors can't do anything except add student names and mark attendance codes (P/A/E), which are the only unlocked cells. I have it set so that they can't even select the locked cells, and it's password protected. I don't see how the instructor could have made any substantial changes to result in this bug.

Any ideas on what happened? It was a fluke we happened to notice this instance, so I'm wondering if it could happen again. I just don't understand why I couldn't update the cell if I worked vertically downward, but skipping down a few blank rows and working up the same column would then magically work.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Do you have any macros in that file, especially a change event code on that sheet?
 
Upvote 0
Sorry for the delayed response.

No, there are no macros. All automation with dates and days of the week is by formula only.
 
Upvote 0
In that case I have no idea what happened. The only way I know a p would change to P is with some Event code.
 
Upvote 0
The only other thing I can think of would be if the column had something like P followed by a space in it. That would cause your COUNTIF formula to ignore it and would also cause the autofill effect whereby if you type "p" it would autosuggest "P " as that is already in the column and if you just press Enter it will accept its autosuggestion. If you enter "p" somewhere separate from the existing data - eg in rows below your current data with some blanks in between - the autosuggestion won't happen and then working back up from there would also remain as "p".
 
Upvote 0
Solution
The only other thing I can think of would be if the column had something like P followed by a space in it. That would cause your COUNTIF formula to ignore it and would also cause the autofill effect whereby if you type "p" it would autosuggest "P " as that is already in the column and if you just press Enter it will accept its autosuggestion. If you enter "p" somewhere separate from the existing data - eg in rows below your current data with some blanks in between - the autosuggestion won't happen and then working back up from there would also remain as "p".

AHAH! That must have been it. I was able to duplicate the problem by intentionally typing a P+space. Thanks!

However, it's disheartening to know it's not as user-proofed as I thought. I guess I could implement data validation for those attendance codes. However, at this point I don't want to retroactively adjust 30 some sheets for the remaining month and half left in the school year. Maybe I'll consider adding data validation to my master copy before I copy out all the new workbooks for next fall.

Hypothetical question - is it ever possible to truly 100% user-proof a sheet?:biggrin:
 
Upvote 0
AHAH! That must have been it. I was able to duplicate the problem by intentionally typing a P+space. Thanks!

However, it's disheartening to know it's not as user-proofed as I thought. I guess I could implement data validation for those attendance codes. However, at this point I don't want to retroactively adjust 30 some sheets for the remaining month and half left in the school year. Maybe I'll consider adding data validation to my master copy before I copy out all the new workbooks for next fall.

Hypothetical question - is it ever possible to truly 100% user-proof a sheet?:biggrin:
You can't idiot proof any spreadsheet or application due to society always producing a better version of an idiot.

I think you'll be covered by adding the Validations you suggested. Conditional Formatting could also help find the errors.
 
Upvote 0

Forum statistics

Threads
1,223,869
Messages
6,175,087
Members
452,611
Latest member
bls2024

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