REKLAMA

program.xls

Excel: Jak stworzyć plik wyświetlający pozycje powtarzających się wartości w jednym wierszu?

Zawsze warto napisać, w której wersji Excela ma pracować to rozwiązanie, bo w różnych wersjach są dostępne różne funkcje. Jeśli chodzi o rozdzielenie formułą do osobnych komórek danych rozdzielonych średnikami, to na upartego się da, ale to dość złożone. W tym przypadku sugerowałbym użycie VBA i funkcji UDF, która przetwarzałaby listę rozdzieloną średnikami. Wywołanie funkcji w arkuszu: =Styki(lista_ze_średnikami; komórki_ze_stykami)Pierwszy argument może być odwołaniem do komórki, drugi argument powinien być poziomym zakresem komórek z listą styków. Długości obu list powinny być zgodne. Listing funkcji (w module uniwersalnym): Function Styki(lista As String, wykaz As Range) As String Dim tabl, i As Long tabl = Split(lista, ";") If UBound(tabl) + 1 <> wykaz.Columns.Count Then Styki = "Dane niezgodne": Exit Function For i = 0 To UBound(tabl) If tabl(i) = 0 Then Styki = Styki & wykaz(1, i + 1) & ", " Next i If Len(Styki) = 0 Then Styki = "Brak wartości 0" Else Styki = Mid(Styki, 1, Len(Styki) - 2) If InStr(Styki, ",") = 0 Then Styki = Styki & " ma wartość 0" Else Styki = Styki & " mają wartość 0" End If End If End Function Załączam plik z rozszerzeniem .xls ze względu na ograniczenia tego Forum. Po odczytaniu zapisz go sobie w formacie .xlsm.


Pobierz plik - link do postu

,,, &quot; 2.Rozdzieli?em dane za pomoca tekst jako kolumny &quot; ,,,,,,,,,,,,,,
, &quot; 1.Dane wyci?gane z programu &quot; ,, &quot; Styk 3 &quot; , &quot; styk 9 &quot; , &quot; styk 12 &quot; , &quot; styk 15 &quot; , &quot; styk 17 &quot; , &quot; styk 18 &quot; , &quot; styk 19 &quot; , &quot; styk 21 &quot; , &quot; styk 22 &quot; , &quot; styk 24 &quot; , &quot; styk 25 &quot;
, &quot; MFR00816AF;L2108120796 &quot; , &quot; 959;979;960;996;969;961;979;907;945;0;0 &quot; , &quot; 959 &quot; , &quot; 979 &quot; , &quot; 960 &quot; , &quot; 996 &quot; , &quot; 969 &quot; , &quot; 961 &quot; , &quot; 979 &quot; , &quot; 907 &quot; , &quot; 945 &quot; , &quot; 0 &quot; , &quot; 0 &quot; ,, &quot; styk 24, styk 25 maj? warto?? 0 &quot;
, &quot; MFR00816AF;L2108120794 &quot; , &quot; 931;894;966;969;941;984;964;921;966;0;0 &quot; , &quot; 931 &quot; , &quot; 894 &quot; , &quot; 966 &quot; , &quot; 969 &quot; , &quot; 941 &quot; , &quot; 984 &quot; , &quot; 964 &quot; , &quot; 921 &quot; , &quot; 966 &quot; , &quot; 0 &quot; , &quot; 0 &quot; ,, &quot; styk 24, styk 25 maj? warto?? 0 &quot;
, &quot; MFR00816AF;L2108120793 &quot; , &quot; 863;899;895;826;932;841;935;849;821;0;0 &quot; , &quot; 863 &quot; , &quot; 899 &quot; , &quot; 895 &quot; , &quot; 826 &quot; , &quot; 932 &quot; , &quot; 841 &quot; , &quot; 935 &quot; , &quot; 849 &quot; , &quot; 821 &quot; , &quot; 0 &quot; , &quot; 0 &quot; ,, &quot; styk 24, styk 25 maj? warto?? 0 &quot;
, &quot; MFR00816AF;L2108120792 &quot; , &quot; 843;972;870;852;834;990;920;955;839;0;0 &quot; , &quot; 843 &quot; , &quot; 972 &quot; , &quot; 870 &quot; , &quot; 852 &quot; , &quot; 834 &quot; , &quot; 990 &quot; , &quot; 920 &quot; , &quot; 955 &quot; , &quot; 839 &quot; , &quot; 0 &quot; , &quot; 0 &quot; ,, &quot; styk 24, styk 25 maj? warto?? 0 &quot;
, &quot; MFR00816AF;L2108120660 &quot; , &quot; 0;861;889;953;938;961;920;924;960;959;888 &quot; , &quot; 0 &quot; , &quot; 861 &quot; , &quot; 889 &quot; , &quot; 953 &quot; , &quot; 938 &quot; , &quot; 961 &quot; , &quot; 920 &quot; , &quot; 924 &quot; , &quot; 960 &quot; , &quot; 959 &quot; , &quot; 888 &quot; ,, &quot; Styk 3 ma warto?? 0 &quot;
, &quot; MFR00816AF;L2108120659 &quot; , &quot; 0;893;916;914;875;914;953;933;879;922;927 &quot; , &quot; 0 &quot; , &quot; 893 &quot; , &quot; 916 &quot; , &quot; 914 &quot; , &quot; 875 &quot; , &quot; 914 &quot; , &quot; 953 &quot; , &quot; 933 &quot; , &quot; 879 &quot; , &quot; 922 &quot; , &quot; 927 &quot; ,, &quot; Styk 3 ma warto?? 0 &quot;
, &quot; MFR00816AF;L2108120658 &quot; , &quot; 0;915;923;926;920;928;913;932;942;948;896 &quot; , &quot; 0 &quot; , &quot; 915 &quot; , &quot; 923 &quot; , &quot; 926 &quot; , &quot; 920 &quot; , &quot; 928 &quot; , &quot; 913 &quot; , &quot; 932 &quot; , &quot; 942 &quot; , &quot; 948 &quot; , &quot; 896 &quot; ,, &quot; Styk 3 ma warto?? 0 &quot;
, &quot; MFR00816AF;L2108120657 &quot; , &quot; 0;0;910;900;912;899;887;967;913;941;913 &quot; , &quot; 0 &quot; , &quot; 0 &quot; , &quot; 910 &quot; , &quot; 900 &quot; , &quot; 912 &quot; , &quot; 899 &quot; , &quot; 887 &quot; , &quot; 967 &quot; , &quot; 913 &quot; , &quot; 941 &quot; , &quot; 913 &quot; ,, &quot; Styk 3, styk 9 maj? warto?? 0 &quot;
, &quot; MFR00816AF;L2108120623 &quot; , &quot; 903;908;917;950;912;964;912;942;888;0;0 &quot; , &quot; 903 &quot; , &quot; 908 &quot; , &quot; 917 &quot; , &quot; 950 &quot; , &quot; 912 &quot; , &quot; 964 &quot; , &quot; 912 &quot; , &quot; 942 &quot; , &quot; 888 &quot; , &quot; 0 &quot; , &quot; 0 &quot; ,, &quot; styk 24, styk 25 maj? warto?? 0 &quot;
, &quot; MFR00816AF;L2108120609 &quot; , &quot; 0;924;902;953;912;930;914;934;895;900;957 &quot; , &quot; 0 &quot; , &quot; 924 &quot; , &quot; 902 &quot; , &quot; 953 &quot; , &quot; 912 &quot; , &quot; 930 &quot; , &quot; 914 &quot; , &quot; 934 &quot; , &quot; 895 &quot; , &quot; 900 &quot; , &quot; 957 &quot; ,, &quot; Styk 3 ma warto?? 0 &quot;
, &quot; MFR00816AF;L2108120573 &quot; , &quot; 0;0;899;947;978;0;926;951;857;958;884 &quot; , &quot; 0 &quot; , &quot; 0 &quot; , &quot; 899 &quot; , &quot; 947 &quot; , &quot; 978 &quot; , &quot; 0 &quot; , &quot; 926 &quot; , &quot; 951 &quot; , &quot; 857 &quot; , &quot; 958 &quot; , &quot; 884 &quot; ,, &quot; Styk 3, styk 9, styk 18 maj? warto?? 0 &quot;
, &quot; MFR00816AF;L2108120572 &quot; , &quot; 0;0;929;942;984;934;934;937;927;988;901 &quot; , &quot; 0 &quot; , &quot; 0 &quot; , &quot; 929 &quot; , &quot; 942 &quot; , &quot; 984 &quot; , &quot; 934 &quot; , &quot; 934 &quot; , &quot; 937 &quot; , &quot; 927 &quot; , &quot; 988 &quot; , &quot; 901 &quot; ,, &quot; Styk 3, styk 9 maj? warto?? 0 &quot;
,,,,, &quot; 4.Potrzebuje po??czy? pozycje 0 z nag?ówkiem z komórek od D12 do N12 ?eby otrzymac np. tekst &quot; &quot; styk 24 i 25 ma warto?? 0 &quot; &quot; &quot; ,,,,,,,,,,