Excel Dynamic Array Dynamically placed under another [closed] - excel

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 months ago.
Improve this question
Use Case: Golf irrigation valve assembly ordering. My boss said:
Hey [piratecheese13], I don't want this part summary to include blanks between [dynamic arrays] and I want to add and remove things to the [precedent to the array]
I have suggested inserting and deleting rows as needed. This is not a solution. She wants to get my list, add and remove rows from the precedent to the array, and send it to a vendor for ordering. Any work she does beyond that, is work she'd rather I do before it gets to her.
I have a neat little Dynamic Array function =FILTER(PartsAndQuantities1,(Parts1<>"")*(IF(Quantities1=0,"",Quantities1)<>""))and it works flawlessly to summarize while removing 0 counts and blank rows. The next step is to insert the same exact formula for a different range without risking a spill if a row is added or a blank if a row is removed
Here's that function in green working as intended with a 2nd function in red manually typed below
Here's what happens if my boss decides to remove a fitting from F9. She sees a blank in the summary a half hour later and assumes there was an error. Again, easily solved by removing a row but that's not an option.
Here's what happens if my boss decides to add a fitting to F12. She sees #Spill! and knows there is an error Again, easily solved by inserting rows but that's not an option.
Things I Have Attempted:
Just stick an & Between 2 functions. I really thought this would work but
this results in F7&F18 and G7&G18 etc as & appears to do work on every line instead of starting after the first FILTER() completes. adding parentheticals around each filter changes nothing. Using + results in value error. Nesting the function within AND() only ever results in Booleans TRUE & FALSE
I've also tried this tutorial on CHOOSE() which handles multiple arrays but only one column and seems like it wouldn't fit
Note: my boss doesn't want to insert lines to solve spill errors, she REALY doesn't want to deal with macro enabled workbooks

Thanks to Scott Craner this was exactly what I needed!
=VSTACK(FILTER(F7:G15,(F7:F15<>"")*(IF(G7:G15=0,"",G7:G15)<>"")),FILTER(F17:G23,(F17:F23<>"")*(IF(G17:G23=0,"",G17:G23)<>"")))

Related

Excel - choose random string from list of strings not including an existing string

I am automating the comments for some test marking, and I wanted to give a bit of variety to the comments I give for correct answers, so I have used the following formula:
=IF(E5=1,CHOOSE(RANDBETWEEN(1,4),"Great work!","Excellent work!","Great job!","Well done!"),"")
Here, if the answer is correct, then cell E5 is set to 1, and it chooses from one of 4 comments and leaves an empty string otherwise.
This works fine, but the test has two questions, and I would prefer it if when both questions are correct, they don't receive the same comment.
For example, if the formula above is in cell E11 and E16=1 indicates question 2 is correct, then I would like to do something along the lines of:
=IF(E16=1,IF(E11="",CHOOSE(RANDBETWEEN(1,4),"Great work!","Excellent work!","Great job!","Well done!"),CHOOSE(RANDBETWEEN(1,3),[set difference of original strings and string in E11])),"")
In plain english: Given question 2 is correct, but question 1 is not, to determine the comment for question 2 just select a random comment from the list; however, if both questions are correct, then the comment for question 2 must be randomly selected from the original list, not including the comment that was given for question 1 (no duplicates).
..but I'm not sure how to make that work in Excel.
EDIT:
I know I could just have two disjoint lists of "correct" comments for each question so there would never be any duplicates, but I am just curious as to whether it is possible to do it this way using Excel or not.
If you have Excel 365 you can just filter out the phrase which has already been used:
=LET(congrats,{"Great work!","Excellent work!","Great job!","Well done!"},
filterCongrats,FILTER(congrats,congrats<>E11),
IF(E16=1,INDEX(filterCongrats,RANDBETWEEN(1,COUNTA(filterCongrats))),""))

Delete rows between certain values [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 9 months ago.
Improve this question
I'd like make a task for my work way more simple, but in pretty lost since I'm just starting to learn VBA.
What I wanna make easier is a process of removing certaing data from an excel sheet.
Please, see the image, I think it's easier to understand.
I'd like to ask for an input of a market in column P. Let's say the user enters "Portugal". Then it would look for the rows that have that value in column P and delete the ones that doesn't contain information for Portugal (e.g. it would delete rows from 6 to 9 and 21 to 25, but rows 2-5 and 10-20 should not be deleted).
Any good ideas? I think it should be simple somehow but I can't think of any solution.
Thanks
Let me teach you some Excel magic:
Select the entire column "P".
Press Ctrl+G , choose "Special" and then "Blanks".
Click in the address bar and type =P2.
Press Ctrl+ENTER (don't forget the Ctrl button!)
This should fill in the "P" column as you desire and from then on, you can use the basic autofilter.

Excel Concatenate a string in multiple columns, count and remove the duplicates

Currently the stock process at my company is very manual and it normally doesn't get carried out due to the process being rather boring. Currently all excel based I am slowly moving over to SQL that will automatically update the information.
We have come up with a naming system/code for each item, this is made up from several fields on the excel document. However there is the same codes in different columns that we wish to remove for when we push into SQL (Basically we just want the 1 line item and a count of how many times it has been used)
It has to be dynamic. (I can add an extra tab to the excel document to do any magic required) and if possible not use any Macros
So the data starts like this:
#Counts and then the duplicates are removed to produce this list
I have tried a range of countifs/Vlookups and I can get it roughly working but its not dynamic enough and I end up having multiple rows of 0 Qtys
Hopefully this is enough information
Cheers all
It looks like a very similar question was answered here.
After plugging in that formula in a different column, you can use the CountIf function in the next column.

Is it possible to have a "dynamic array" inside MATCH function? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have a large amount of data that was converted to excel recently.
There are just two columns and more than 100000 lines. There is an Image as an example attached here.
The systems are always in the second columns as well as the data, but the loads and the rest of the information are in the first column, as you can see in the example, the "Max load" always repeat, but in the system 001 there is a difference of two lines between it and the system name, but in the second system the difference is three lines. I want to make a table for Max load with all the systems, those are the things I tried:
I used MATCH to find the line where the System name appears, knowing that the difference would be either 2 or 3 lines, I made a table with 2 and 3 in the header and I added it to the line I found and MATCH, it kind of work, but I wanted something better than this improvisation.
I also tried using (where X2= the line where the system name appears)
=MATCH(AA1;OFFSET(A1:X2:0:100:1);0)
Because I thought that OFFSET would return a range to MATCH, but it didn't work.
I want to know if there is a way to find the text "Max load" after the line I found using the Systems' names in MATCH. Basically, I want to know if there is a way of using kind of a "dynamic array" inside MATCH, so I would use it to find "Max load" right after the system that I am looking for.
I don't if this works, but if there is any other way of doing it, I am glad to know about it.
Thanks very much,
Matheus
You can use multiple match with index. Use below formula. It will not care how many rows are different from system to data.
=INDEX(D:D,MATCH(H4,D:D,0)+MATCH("Max Load",INDIRECT("C" & MATCH(H4,D:D,0) & ":C200000"),0)-1)
I think you are overthinking this way too much. If you just have either two or three rows, if offsetting the answer by 1 gives you 0 then use a simple if statement to offset it by 3.
=IF(INDEX(E:E,MATCH(H3,E:E,0)+2)>0,INDEX(E:E,MATCH(H3,E:E,0)+2),INDEX(E:E,MATCH(H3,E:E,0)+3))
Another option
In I4, formula copied right to J4 and all copied down :
=INDEX($D:$D,AGGREGATE(15,6,ROW($C$6:$C$1000)/($C$6:$C$1000=I$3),ROW($A1)))
Another solution would be
=INDEX(INDEX($D:$D,MATCH($F4,$D:$D,0)):$D$200000,MATCH(G$3,INDEX($C:$C,MATCH($F4,$D:$D,0)):$C$200000,0))

Combining multiple IF/AND/THEN statements Part 2

After having solved the initial programming question by using the following calculation...
=IF(OR(AND($D11="Long",$M11>=$N11),AND($D11="Short",$M11<=$N11)),"Win","Loss")
The secondary question relates to when D11 is blank. I have tried a number of ways including using ISBLANK in tring to include this in the calculation.
The calculation will reside in R11. So written out... IF D11 is blank then blank otherwise the above calculation will take place. Not sure how to place this within the above calculation to make it work. My efforts have been incorrect.
You can just add that first, in this generic form
=IF($D11="","",your_formula)
so specifically that becomes:
=IF($D11="","",IF(OR(AND($D11="Long",$M11>=$N11),AND($D11="Short",$M11<=$N11)), "Win","Loss"))
see screenshot

Resources