Combine multiple columns with differing numbers of cells into one column - excel

I am attempting to combine multiple columns that get filtered results from another workbook that uses checkboxes. The checkboxes when true send a ticker to another sheet but to 6 separate columns. My goal is to automatically form these tickers into their own column once sent to the other workbook.
The workbook which receives the tickers can look like this in each of their own columns.
(The format when I post this shows 8 columns but its only 6 FYI, A:F)
WTRH PRKR GESI REV XPON
#CALC!
SIMP CNTA
ELMS MNSO
CXDO
I tried doing a text join separated by a comma but it won't work anytime a column doesn't have a value. (Coming from the other spreadsheet column D is tickers from a portfolio, column E is insider buying, etc and sent by making checkboxes true)
Either way my goal is to get the tickers into one column with each in its own row automatically every time I check a box from the other workbook.
For instance
WTRH
PRKR
GESI
REV
XPON
SIMP
CNTA
ELMS
MNSO
CXDO
I'm still very new to VBA and after attempting to use intersect and making a row count I only got more confused. Any help is greatly appreciated! Thank you.

If you are open to go with formula then could try-
=FILTERXML("<t><s>"&TEXTJOIN("</s><s>",TRUE,IF(IFERROR(A1:H3,0)<>0,IFERROR(A1:H3,0),""))&"</s></t>","//s")

Related

Replace values in columns based on matching IDs between sheets

I usually do my data cleaning in python but the issue with python (pandas) is that when you read and print a table to excel it doesn't retain any of the excel formatting.
In this case I was given a large table where a lot of the cells are color coded and or commented. I need to retain all the coloring, comments, font styles and etc. I don't know how else to do that but to work in excel
The issue:
In one sheet I have a large table (400 rows x 45 columns). It is structured like below
Sheet 1:
|ID|C|D|E|F|
:--|:--|:--|:--|:--|
|EDMU025|1|2|3|4|
|EDMU026|5|6|7|8|
|EDMU027|9|2|3|4|
|EDMU028|5|6|7|8|
In another sheet I have a series of small tables which look like this
Sheet 2:
|ID|Date|C|D|E|F|
:--|:--|:--|:--|:--|:--|
|EDMU025|9/14/22|100|210|300|450|
|EDMU025|9/14/22|100|200|340|400|
|||||||
|Value to be replaced||100|200|300|400|
|||||||
|EDMU028|9/14/22|700|810|900|550|
|EDMU028|9/14/22|700|800|940|500|
|||||||
|Value to be replaced||700|800|900|500|
For each ID in Sheet 2 I need to find the ID in Sheet 1 and replace the values in sheet 1 columns C-F with the Values to be replaced.
The output would be:
|ID|C|D|E|F|
:--|:--|:--|:--|:--|
|EDMU025|100|200|300|400|
|EDMU026|5|6|7|8|
|EDMU027|9|2|3|4|
|EDMU028|700|800|900|500|
What is the most efficient way to do that for the entire table (while still keeping the original values that don't need to be replaced intact?)??
Try nested XLOOKUP() like-
=XLOOKUP(A2,Sheet2!$B$1:$B$15,Sheet2!$D$1:$G$15,XLOOKUP(A2,$A$2:$A$15,$B$2:$E$15,"",0),0,-1)

Combining 2 columns into one using INDIRECT in Google Spreadsheet

I have a Spreadsheet with multiple sheets.
In one of them I'm trying to populate a column combining the value of two columns from another sheet.
Something like: Col1: City, Col2: Country -> In new Sheet, Location = (Col2), (Col1).
I've tried this but so far no luck:
=INDIRECT("FormaData!P2:P"&"FormData!O2:O")
FormData is the name of the external sheet, and the columns that I'm trying to automatically populate from are:
P2 to end of P (city) and O2 to end of O (country).
Any help will be highly appreciated!
This should work all the way down
=arrayformula('FormaData'!P2:P&", "&'FormaData'!O2:O)
Are you using a different spreadsheet altogether? If so you need to modify it to use import range:
=ARRAYFORMULA(IMPORTRANGE("spreadsheet url","'FormaData'!P2:P")&","&(IMPORTRANGE("spreadsheet url","'FormaData'!O2:O")))

Using a Macro to get excel to check a spreadsheet for a match to a data entry

I have checked many possible answers but none match it close enough.
Our fixtures inventory is on Excel.
1) I use a scanner to check the tag numbers on inventory items which puts it in another sheet.
2) Currently after I finish a room of furniture I sort the numbers in numeric order than move to the main sheet and copy the tag numbers (already in numeric order) and description and past it into the next column.
3) I then compare the numbers to see that they match.
I can create a macro to copy and paste the first number row but it won't do the next one.
Also when recording the macro I am coping the tag number from the cell and pasting it in search, when it matches I copy and paste the matched cell (tag number) and next cell to it ( description of item) to my target cell.
But I am not sure the macro is doing the search or just using what I set to copy.
Inventory sheet Column A = room number Column D=inventory tag Column E= description.
Example of what I want it to do:
I scan in product code 67-12345. [would be in column D sheet = inventory check}
I want the computer to move to the Inventory sheet
do a search for that tag number
When it gets a match [from column D in sheet = inventory]
copy and paste that cell and the one next to it [column D,E as well as column A (all on the same row) sheet = inventory] into sheet inventory check = [column D (D=D), E (E=E)and(C=A)
note: {info copied from A Inventory sheet into C inventory check sheet}*
Then go to the next row in [column D sheet = inventory check] and if populated continue the process.
I can live with having to run the macro for each line check, it just means running it 40 or 50 times per room.
I hope I have not made this too confusing in trying to explain it completely. Any help would be appreciated. I'm competent in Visual Basic for not overly complicated stuff. Also I use EXCEL 2013

Excel Formunal needed to Merge

Hey All on my excel sheet there is a column that i need to concatenate. I need the combine all the rows in the same colors into one row, I need to do this for a list of 10000+ rows. Any ideas?
ALSO THE COLORS I added in to explain what I need to combine, there are no colors in the spreadsheet.
In a helper column (just any empty column, I Assume AA here, change that to your needs) starting with row 1 (I assume the colored column is F, change that to your needs):
=IF(LEN(A2),F1,F1&", "&AA2)
copy down till the end
copy whole column
paste as values only (to column F)
Set filter to show only rows which are empty in column A
select all
delete all
turn off the filter
finished :)
If you are willing to use VBA it could be as simple as inserting this into a module and then using it with other regular functions to build your string:
Function WhatColor(r As Range) As Long
WhatColor = r.Cells.Interior.Color
End Function
If it has to be a "somewhat" native function, check out the GET.CELL answer here.

Excel filter Multiple Value in One Cell

I am looking for help on filtering multiple values in one cell delimited by a comma.
For example I have a spreadsheet with the following data:
Column A (Risk) Column B (Risk Mitigation)
Risk A Requirement1, Requirement2
Risk B Requirement2, Requirement6, Requirement7
Risk C Requirement1, Requirement3, Requirement9
When I filter on the 'Requirement Mitigation' Column I would like to see check boxes for the following:
Requirement1
Requirement2
Requirement3
Requirement4
Requirement5
...
Requirement9
So for my example when I only check the Requirement 1 filter box, only 'Risk A' and 'Risk C' rows would be displayed
Currently when I filter it does by the unique cell value, which gives me
Requirement1, Requirement2
Requirement2, Requirement6, Requirement7
Requirement1, Requirement3, Requirement9
Please note that above is just an example and I have thousand of individual requirements, so it would not be as simple as having one column per requirement.
I open to any suggestions including creating vbscripts.
Any help would be greatly appreciated.
This will be tricky.
First you'll need to create a form that will contain a list box and populate that list box with the Requirements you have in their correct syntax.
Then you'll need to create a loop that will go through every cell in a column and save each of them to a string, you could make a one dimensional string array to save them all in that as well.
Then you'll need a loop that will go through each string and use the split function to seperate the strings with a delimeter, you'll need to set your delimiter to ", " to ensure it seperates the strings at the commas.
Then you'll need a loop that will run after you've made your selection from the listbox in your form. this loop will go through every string in your 2D array and check if it contains any of the requirements in your listbox. If it is not, run the code: Range("B" & x).EntireRow.Hidden = True where x is the row, you can use one of the variables in your loop for this.
If you need more specific information that this I may need to see what you've already done, it is possible as well to use this method to automatically populate the list box in your form.

Resources