Vbe to search for selected cell value in another table

Xalova

Board Regular
Joined
Feb 11, 2021
Messages
80
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
The situation is as follows:

I have a "main table" which is *full* of data. Im talkin abut 1500 entries. Then i have another table, which is for filtering. I have already figured out how to filter the table for what im looking at.

But what i now need is a way to search for a selected value from the filtered table in the main table and select it. Idk, if thats enough information, but i try to provide more:

The main table has about 10 columns. Not every column in every row is filled. Thats rarely the case. But i want to be able to enter information retropspectivly. So the best way i could think of is:
I search the table for my desired information, see that a item isnt fully descripted in the main table, select the the name of said item, click the macro button, and then VBA magic happens and it selects the Cell in the main table with the same value as the selected cell.

Im open for new ideas tho, which may be easier!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
I think it would be really beneficial for our understanding to see an actual example of your data tables and how you want this to work.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
I think it would be really beneficial for our understanding to see an actual example of your data tables and how you want this to work.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
the thing is that i wrote it all in german instead of english. is that a problem?
 
Upvote 0
the thing is that i wrote it all in german instead of english. is that a problem?
The fact that the data is in German shouldn't be a problem, as long as your explanation of how you want the example to work for us is in English.
 
Upvote 0
The fact that the data is in German shouldn't be a problem, as long as your explanation of how you want the example to work for us is in English.
Got you. in that case i will post a sample soon.
 
Upvote 0
The fact that the data is in German shouldn't be a problem, as long as your explanation of how you want the example to work for us is in English.
Okay, so this is a small sample of the main table which i feed all the information to. As i said, this table has a lot of entries.

Komm.- u. Angebotsnummern_Filter 2.xlsm
ABCDEFGHIJKLM
4G-NrBeschreibungAlternative Beschreibungneue G-Nr.LieferantTypKennzeichenFahrerBemerkungnvInfo für RechnungenKategorie Nr. OrgaMaxKategorie OrgaMax
51Magazin UmbauoGebäude
62Werkstatt-einrichten/WerkbänkeoGebäude
73Betriebsgründungo
85Büro - BlockhausoGebäude
96SchweißtechnikG606Schweißtechniknicht mehr verwenden !!!x
G-Nummern


And this is the table which i use for filtering (as seen in cell "C3") This formula references the whole table and filters it to whatever matches the criterias in the cells "C2" and "D2".

Komm.- u. Angebotsnummern_Filter 2.xlsm
CDEFGHIJKLMNO
1G- NrBeschreibung und Alternative beschreibungneue G-Nr.LieferantTypKennzeichenFahrerBemerkungnvInfo für RechnungenKategorie Nr. OrgaMaxKategorie OrgaMax
2
3G-NrBeschreibungAlternative Beschreibungneue G-Nr.LieferantTypKennzeichenFahrerBemerkungnvInfo für RechnungenKategorie Nr. OrgaMaxKategorie OrgaMax
41Magazin Umbau-o-Gebäude-------
52Werkstatt-einrichten/Werkbänke-o-Gebäude-------
63Betriebsgründung-o---------
75Büro - Blockhaus-o-Gebäude-------
86Schweißtechnik-G606-Schweißtechnik--nicht mehr verwenden !!!x---
Filtertabelle
Cell Formulas
RangeFormula
C3:O3C3=Verbrauchsmaterial[#Headers]
C4:O542C4=LET(Advanced, IFS(E2<>"",SEARCH(E2,INDIRECT("Verbrauchsmaterial["&E3&"]")),F2<>"",SEARCH(F2,INDIRECT("Verbrauchsmaterial["&F3&"]")),G2<>"",SEARCH(G2,INDIRECT("Verbrauchsmaterial["&G3&"]")),H2<>"",SEARCH(H2,INDIRECT("Verbrauchsmaterial["&H3&"]")),I2<>"",SEARCH(I2,INDIRECT("Verbrauchsmaterial["&I3&"]")),J2<>"",SEARCH(J2,INDIRECT("Verbrauchsmaterial["&J3&"]")),K2<>"",SEARCH(K2,INDIRECT("Verbrauchsmaterial["&K3&"]")),L2<>"",SEARCH(L2,INDIRECT("Verbrauchsmaterial["&L3&"]")),M2<>"",SEARCH(M2,INDIRECT("Verbrauchsmaterial["&M3&"]")),N2<>"",SEARCH(N2,INDIRECT("Verbrauchsmaterial["&N3&"]")),O2<>"",SEARCH(O2,INDIRECT("Verbrauchsmaterial["&O3&"]")),P2<>"",SEARCH(P2,INDIRECT("Verbrauchsmaterial["&P3&"]")),Q2<>"",SEARCH(Q2,INDIRECT("Verbrauchsmaterial["&Q3&"]")),R2<>"",SEARCH(S2,INDIRECT("Verbrauchsmaterial["&R3&"]")),S2<>"",SEARCH(S2,INDIRECT("Verbrauchsmaterial["&S3&"]"))), FilterGnr, FILTER(Verbrauchsmaterial,ISNUMBER(SEARCH(C2,Verbrauchsmaterial[G-Nr]&Verbrauchsmaterial[neue G-Nr.])*SEARCH(D2,Verbrauchsmaterial[Beschreibung]&Verbrauchsmaterial[Alternative Beschreibung])*IF(ISERR(Advanced)=FALSE,1,Advanced)),"keine Artikel vorhanden"), IF(FilterGnr=0,"-",FilterGnr))
Dynamic array formulas.


Because this "FilterTable" isnt the Table with all the data itself, but just a "Copy" of it, i cant edit those values shown in the filtered table. What i want to achieve is something that makes me able to edit those values directly, or something that lets me find a the cell i filtered for in the main table.


Komm.- u. Angebotsnummern_Filter 2.xlsm
CDEFGHIJKLMNO
1G- NrBeschreibung und Alternative beschreibungneue G-Nr.LieferantTypKennzeichenFahrerBemerkungnvInfo für RechnungenKategorie Nr. OrgaMaxKategorie OrgaMax
2gebäude
3G-NrBeschreibungAlternative Beschreibungneue G-Nr.LieferantTypKennzeichenFahrerBemerkungnvInfo für RechnungenKategorie Nr. OrgaMaxKategorie OrgaMax
41Magazin Umbau-o-Gebäude-------
52Werkstatt-einrichten/Werkbänke-o-Gebäude-------
65Büro - Blockhaus-o-Gebäude-------
Filtertabelle
Cell Formulas
RangeFormula
C3:O3C3=Verbrauchsmaterial[#Headers]
C4:O15C4=LET(Advanced, IFS(E2<>"",SEARCH(E2,INDIRECT("Verbrauchsmaterial["&E3&"]")),F2<>"",SEARCH(F2,INDIRECT("Verbrauchsmaterial["&F3&"]")),G2<>"",SEARCH(G2,INDIRECT("Verbrauchsmaterial["&G3&"]")),H2<>"",SEARCH(H2,INDIRECT("Verbrauchsmaterial["&H3&"]")),I2<>"",SEARCH(I2,INDIRECT("Verbrauchsmaterial["&I3&"]")),J2<>"",SEARCH(J2,INDIRECT("Verbrauchsmaterial["&J3&"]")),K2<>"",SEARCH(K2,INDIRECT("Verbrauchsmaterial["&K3&"]")),L2<>"",SEARCH(L2,INDIRECT("Verbrauchsmaterial["&L3&"]")),M2<>"",SEARCH(M2,INDIRECT("Verbrauchsmaterial["&M3&"]")),N2<>"",SEARCH(N2,INDIRECT("Verbrauchsmaterial["&N3&"]")),O2<>"",SEARCH(O2,INDIRECT("Verbrauchsmaterial["&O3&"]")),P2<>"",SEARCH(P2,INDIRECT("Verbrauchsmaterial["&P3&"]")),Q2<>"",SEARCH(Q2,INDIRECT("Verbrauchsmaterial["&Q3&"]")),R2<>"",SEARCH(S2,INDIRECT("Verbrauchsmaterial["&R3&"]")),S2<>"",SEARCH(S2,INDIRECT("Verbrauchsmaterial["&S3&"]"))), FilterGnr, FILTER(Verbrauchsmaterial,ISNUMBER(SEARCH(C2,Verbrauchsmaterial[G-Nr]&Verbrauchsmaterial[neue G-Nr.])*SEARCH(D2,Verbrauchsmaterial[Beschreibung]&Verbrauchsmaterial[Alternative Beschreibung])*IF(ISERR(Advanced)=FALSE,1,Advanced)),"keine Artikel vorhanden"), IF(FilterGnr=0,"-",FilterGnr))
Dynamic array formulas.



For this Example:
I typed in cell "H2" "Gebäude". Now all those Rows where the word "Gebäude" in the column "Typ" exists are shown. In this example 3 rows in total (Numbers 1,2 and 5). Now that i can see my desired cell (lets say i wanted to look for Nr.5) i click on the 3rd row in the table, which starts with the number 5. Now i preferably want to use a macro with a keyboard shortcut which searches for the selected cell value in the main table and selects that one.


Is that understandable? It sure is hard to bring over what i actually mean..
 
Upvote 0
Unfortunately, I am very confused by it. I have never used the LET or FILTER formulas in Excel before, so it is out of my area of expertise.
When I have problems like these, I usually use Microsoft Access, where it is very easy to query and filter data.

I am sure it might be hard for you to explain the problem too if Excel is not your native language. Note that we do have a Questions in Other Languages forum, that allows you to post your questions in your native language. I know we have some German speaking members on the board (no idea how many though).
 
Upvote 0
Unfortunately, I am very confused by it. I have never used the LET or FILTER formulas in Excel before, so it is out of my area of expertise.
When I have problems like these, I usually use Microsoft Access, where it is very easy to query and filter data.

I am sure it might be hard for you to explain the problem too if Excel is not your native language. Note that we do have a Questions in Other Languages forum, that allows you to post your questions in your native language. I know we have some German speaking members on the board (no idea how many though).
Yuh, basicly what i expected. Thank you anyways though! I will try to use the Forum for other languages.

But the formulas itself arent really important for what i am asking for, are they? Like, there has to be a way that some VBA code can search for a selected cell value in another range, right?
 
Upvote 0
But the formulas itself arent really important for what i am asking for, are they? Like, there has to be a way that some VBA code can search for a selected cell value in another range, right?
Yes, you can use the popular "Find" functionality in VBA.
Just turn on the Macro Recorder, and record an example of a Find in a range, and you will have the structure of the VBA code you need to do this.
If you need some help cleaning that recorded code up, post it back to this thread with the details of how it needs to be changed to suit your needs.
 
Upvote 0
Yes, you can use the popular "Find" functionality in VBA.
Just turn on the Macro Recorder, and record an example of a Find in a range, and you will have the structure of the VBA code you need to do this.
If you need some help cleaning that recorded code up, post it back to this thread with the details of how it needs to be changed to suit your needs.
Did it. But can i limitate the search function in such a way that it only searches a certain range (in this case a table) in another sheet for the value?
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,193
Members
452,616
Latest member
intern444

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