Count the number of missing required fields in Google Sheets - google-sheets

I have a Google Spreadsheet, used like a form, with multiple "Skills", all of which have 2 fields within them, a "required field" (used as a flag for if entry in that field is necessary) and a "Current field" (where the user provides input). I am trying to create a "Inputs Left" field which counts the number of "Required fields" which do not currently have an entry in the "Current field" across all of the fields (seen below).
To do this, I am currently using this formula (C12:P12 is the range with the values in it).
=COUNT(FILTER(C12:P12,ISODD(COLUMN(C12:P12)-COLUMN(C12)),C12:P12>0)) - COUNT(FILTER(C12:P12,ISEVEN(COLUMN(C12:P12)-COLUMN(C12)),C12:P12>=0))
The issue I am running into is when a "Skill" is not required, but a value is entered. With this formula, it counts this towards the number of inputs left, however I only want it to count towards this if it is a required field, while still allowing the user to input non-required skills (see below). In this situation, I would like to have it still show that 2 inputs a left (specifically skill 3 and 4 still need input)
I believe I could do this using a OnEdit() trigger with google scripts, but I would like to have it done using a formula if possible. I also believe I could do this with a series of normal If statements, but the actual document has many more "skills", and I believe an endless list of if statements would be hard to debug in the future. Any help is appreciated!

Ended up using a COUNTIFS statement:
=COUNTIFS(FILTER(C12:P12,ISODD(COLUMN(C12:P12)-COLUMN(C12))),">0",FILTER(C12:P12,ISEVEN(COLUMN(C12:P12)-COLUMN(C12))),"")
Because I imagine it's confusing why there is a ISEVEN(COLUMN(C12:P12)-COLUMN(C12)) (and ISODD), the reason is because I needed to do multiple of the "Inputs Left" Fields, and the "Required" field would switch between being even and odd, meaning I would need to edit the formula a lot. Using the COLUMN(C12:P12)-COLUMN(C12) normalized this, so the "Current" was always even and the "Required" was always odd.

Related

want to name the formula in drop down list

in my original workbook i want to display some values from another sheet for multiple actions.. so i put drop down list for each actions. but when the actions increased i couldn't recognize each formulas. (all of them are import range) so that if i can name each formulas in the drop down then i can recognize fast which action to be performed. here a sample sheet is attached for a solution.. pls take a look. in the dropdown list i included (=a2+b2) instead of that if it displayed as addition in drop down list would be help ful. please take a look.
sorry for my english
Any type of help would be appreciated.
https://docs.google.com/spreadsheets/d/1mpIWyQASMlxRVdlTkv9K1e4oihsrckjT6sD1mLDxvEc/edit#gid=0
If I understand correctly, you want to have a dropdown list menu (from Data Validation) that displays the operation name, but when you click it, it displays just the result.
This is very hacky, but here's a way to create some "labels" in your criteria box:
=IF(;"ADDITION";A2+B2),
=IF(;"SUBTRACTION";A2-B2),
=IF(;"DIVISION";A2/B2),
=IF(;"MULTIPLICATION";A2*B2),
How?(!)
After kicking around some no-op ideas, I finally settled on this as the cleanest and most flexible approach. (By some freak coincidence, it also makes some semantic sense too.) It works because when the first argument to IF is omitted, it defaults to 0 -> FALSE. This effectively makes the second argument to IF a comment/no-op, and always just selects the formula.
Yes, the semicolons are intentional or the parser will think of the args as list items.
Productivity Tip/Footnotes
Sheets will remove any line breaks in your validation criteria, so the formula will be hard to read when you have to edit it. If you anticipate that you'll be adding a bunch of functions later, save the above block in a text file and edit that. Then you can copy+paste it into the validation field.
It will also always show up as "INVALID" because the value will of course never match the formula text.

Array formula skipping blanks, importing adjacent cell

I am trying to automate simple tasks in my google sheets accounts:
(Link to sheet:here)
I would like all transactions under "Money In" in "Bank Statement" to automatically be entered into "Cash In" with the Descriptions, amounts and payment method carrying over. Similarly, I would like all transactions under "Money Out" in "Bank Statement" to be entered into "Cash Out" with the descriptions, amounts and payment method carrying over. Any help as to how this could be achieved would be greatly appreciated.
I don't understand your approach to the problem given the formula you're using. It seems to me that what you're asking should be a simple FILTER or QUERY, e.g.:
=FILTER(Bank!A4:B, Bank!B4:B<>"")
As player0 states, we don't know much without seeing your sheet and data, however. Theoretically, the above formula placed in Accounts!A4 (or A1, A2, A3) would do what you're describing, given that the range A4:B were previously blank.
UPDATE BASED ON COMMENTS AND SHEET:
Formulas in place:
=FILTER({'Bank Statement'!A3:B,'Bank Statement'!D3:D,'Bank Statement'!C3:C},'Bank Statement'!D3:D<>"",'Bank Statement'!E3:E="")
=FILTER({'Bank Statement'!A3:B,'Bank Statement'!E3:E,'Bank Statement'!C3:C},'Bank Statement'!E3:E<>"",'Bank Statement'!D3:D="")
This could have been done with a QUERY as well. But this may be easiest for you to understand. The setup between the curly brackets is a virtual array, which allows choosing the order of the columns. The two parts outside the curly brackets set the conditions (which are opposite depending on the page).

List or auto-complete existing string values, for new plaintext cell

I have a plaintext column in my Google spreadsheet, several rows (cells) of which have already been filled with a limited number of strings, let's say for simplicity "January", "February", "March", etc.
I would like to format the column such that, when entering text in new (empty) cells, rather than having to type the text from scratch, I instead get to choose from a drop-down list populated with the strings that already exist in other cells of that column (all 12 months, in the example above).
Or, alternatively, to have an auto-complete that would suggest, say, "March" and "May", once I start typing "M". Strangely, I haven't seen this basic feature at work in GSheets for a while, even though the EnableAutocomplete option is checked in the menu.
Among the two options, I would prefer the one with the drop-down list over the autocomplete one, but ultimately either would be of massive help. The idea is, once the number of unique strings becomes high (but there is also a lot of repetition), to reduce the chance of making a typo when entering new values just because they happen to differ by one letter from a string that already exists elsewhere.
Is there a way to do this just via the GUI/addons? I know this is possible to do in Excel for the header row (screenshot below), but I don't know of a way to do that also in GSheets, and in either case, what I need is to have this sort of selection list at the cell- rather than at the header-row level.
what you are looking for is called Data Validation:
and you can select various options for criteria

How to auto populate specific Google Form fields, based on dropdown choice

I use Google Forms regularly at work, and I think they are awesome, especially since I am a total newbie with coding. With a few good plugins for Forms and Sheets, I am able to generate contracts, invoices, and so on very easily, based on document templates.
To keep it short, here is my request:
I have a form, where I input the customer's details, and upon submission, an addon generates a gdoc, based on a template. Al working great so far. My problem is that we are generating many different documents for a single customer, so it becomes a repetitive and very time-consuming task, considering that I have 15-20 different input fields for a customer, plus specific input fields for each different document.
The first input filed in my form is "Customer Name" and I have managed to create a dynamic dropdown list, that takes it's information from a specific column in a Google Sheet.
My request: how could I auto populate specific input fields in my Google Form, so that, based on my dropdown choice, the auto completed information will match the corresponding row present in the Google Sheet.
I have attached 2 images for easier understanding:
You can actually do this with a simple vlookup:
note: I also always wrap my functions with and if statement that checks if there is text in the first field, so try:
pretend that your dynamic customer name is in cell A1:
customer vat formula -
=IF(ISTEXT(A1),VLOOKUP(A1,'Parteneri'!A:C,2,FALSE),)
customer city formula -
=IF(ISTEXT(A1),VLOOKUP(A1,'Parteneri'!A:C,3,FALSE),)

Generating values for dropdown ONLY for 'C' of CRUD

When choosing 'Add' in CRUD, how best to generate a list of choices to pick from a dropdown?
For U/update - just display what's there...
The field contents starts with a letter, followed by five numeric digits:{A-I,K-N,Z}#####
Each letter has a different 'max' value for the numeric part.
So when adding a new record, I'd like to offer a listbox with one of each letter and that letter's highest numeric value + 10.
So, if the max 'A' as A00120, and max 'B' B00030 (etc) the listbox would have A00130 and B00040.. etc
Save the user having to figure out which is 'next' when generating a new record.
? Thanks,
Mark
This time I'll not be able to come up with ready to use solution, but I must say - everything is possible with ATK4. You just have to customize and extend it to fit your needs :)
Speaking about your question above - I guess you have to split it in multiple parts.
First part is about how to show select box on Create and readonly or disabled field on Update. I guess you can make some custom Form field or pin some action to existing Form Field hook. Not sure exactly what's better in this case.
Second one is about data structure. I believe that this field actually should be 2 fields in DB and maybe (only maybe) merged together in ATK model with addExpression() just for user interface needs to display these 2 fields as one field easily in UI. Maybe such concatenated field will be useful also for searching, but definitely not as only one field stored in DB. Imagine how hard it'll be for DB engine to find max value if such field. Store it like type = letter, num = number and then search like SELECT max(num)+10 FROM t WHERE type='A'
Finally Third part is about how to generate this next number. I read your question 3 times and came to conclusion that actually you don't have to show this +10 numeric value in UI at all if it's hardly predefined anyway. Actually that'll not work correctly if this will be multi-user system which I guess it will. Instead just show simple select box with letters {A-I,K-N,Z} and calculate this next value exactly before inserting data in DB. That can be done using models insert hook. This will be much more appropriate solution and will be better for UI and also more stable because calculated in model not incorrectly in UI part.

Resources