Anzahl Zeichen in Excel zählen

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Anzahl Zeichen in Excel zählen

Re: Anzahl Zeichen in Excel zählen

Post by flyingDman » 22 Sep 2023, 11:52

So wie ich es verstehe, möchten Sie die längste ununterbrochene Reihe von „x“ in Spalte A zählen. Versuchen Sie Folgendes:

Code: Select all

xl := ComObjActive("excel.application")
max := 0, cnt := 0
for c in xl.Intersect(xl.range("A:A"), xl.ActiveSheet.UsedRange)
	cnt := (c.value = "x") ? (++cnt, max := max(max, cnt)) : 0

msgbox % max

Re: Anzahl Zeichen in Excel zählen

Post by Ahk_fan » 22 Sep 2023, 08:01

in Excel mit ZÄHLENWENN
2023-09-22 14_57_53-Mappe1 - Excel.png
2023-09-22 14_57_53-Mappe1 - Excel.png (12.9 KiB) Viewed 917 times
oder siehe hier:
viewtopic.php?f=76&t=105825&p=470045&hilit=excel+count#p470045

in deinem Fall sieht es so aus:

Code: Select all

xl := ComObjActive("excel.application")
lstrw := xl.Range("A" xl.Rows.Count).End(-4162).Row
anz := 0
loop, %lstrw%
{
	if xl.Range("A" A_Index).Value = "x" 
		anz += 1 
}
msgbox % "anz x: " anz  " letze Zeile" lstrw

Anzahl Zeichen in Excel zählen

Post by Rumborak » 22 Sep 2023, 07:48

Hallo Zusammen,

ich habe ein Excel in deren Spalte A ein x drinnen steht. Allerdings mit Unterbrechung z.B.:
y
x
x
y
y
x
y

Gibt es eine Möglichkeit die Anzahl der x'e zu zählen, die ohne unterbrechung sind? Also oben begonnen, wäre das dann die Anzahl 2.

Danke und Grüße, Thomas

Top