答えて
VBAの答えがあります;
Function AfterSecondVowel(InputRange As String)
'Put all the ascii codes for vowels (upper and lower case) in an array
asciicodesforvowels = Array(65, 97, 69, 101, 73, 105, 79, 111, 85, 117)
Dim Counter As Integer
Dim i As Integer
Counter = 0
'Loop through all the letters in the input string
For i = 1 To Len(InputRange)
'Check to see if trying to match the current letter (converted to an ascii code) you are on from the input range
'is in the array of ascii codes - If it isn't this will throw an error
If Not IsError(Application.Match(Asc(Mid(InputRange, i, 1)), asciicodesforvowels, False)) Then
'Increment your counter by 1
Counter = Counter + 1
End If
'Check to see if the counter has reached 2 yet - You can change the = 2 bit here to any number you want to return
'the letter after the N'th vowel
If Counter = 2 Then
'If it has reached the second vowel, skip to the next letter
i = i + 1
'Set the output of the function to this letter you've moved to
AfterSecondVowel = Mid(InputRange, i, 1)
'Exit the function
Exit Function
End If
'Otherwise loop through to the next letter
Next i
'If you reach the end of the letters without exiting the function it's because there weren't
'two vowels so exit the function returning the string value 'Nothing'
AfterSecondVowel = "Nothing"
End Function
これはあなたの仕様に従って値を返します、あなたが指定していない唯一のことは、第二母音が最後の文字であれば、それはどのように振る舞うべきかである - 上記は、単に空の文字列を返します。
以下は私の答えです。私は、2番目の母音があるかどうかをチェックするロジックを追加しました。もしそれがなければ、エラー文字列をスローします。詳細はスクリーンショットを参照してください。
= IF(A1 <> ""、IFERROR(MID(A1、(FIND "|"、SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(LOWER(A1)、 "A"、 "|") ( "|"、 "e"、 "|")、 "i"、 "|")、 "o"、 "|")、 "u"、 "|")、FIND( "|"、SUBSTITUTE(SUBSTITUTE(SUBSTITUTE ( "a"、 "|")、 "e"、 "|")、 "i"、 "|")、 "o"、 "|")、 "u"、 "|" "))+ 1)+1,1)、" 何 二母音が見つかりませんでした ")、" ")
あなたのフレーズが、セルA1を開始すると、このようなデータを設定していると仮定し
Upvoted。リフレッシュされた質問[ここ]で使用される(http://stackoverflow.com/q/36978101/641067) – brettdj
コラムA:
セルB1と、そのセルが選択されてを選択し、名前付き範囲を作成します。私はLetterAfterVowel2
それを命名し、それは、この式で定義されています
=MID($A1,MIN(SEARCH({"a","e","i","o","u","y"},$A1&"aieouy",MIN(SEARCH({"a","e","i","o","u","y"},$A1&"aieouy"))+1))+1,1)
今、私たちはその混乱に一つ一つの時間を入力する必要はありません、それは完成式がはるかにきれいになります。ダウンコピーされたセルB1とでは、この式である:
=IF(A1="","",IF(LetterAfterVowel2=" ","Nothing",LetterAfterVowel2))
- 1. 文字列の2番目の母音の後に文字を見つける方法
- 2. 文字列の最後の母音を見つける
- 3. Java:文字列内の2番目の文字を見つける方法は?
- 4. 最後の文字列を検索して文字列の2番目の文字列を見つけよう
- 5. Python:i番目の文字とj番目の文字を置き換える方法は?例えば
- 6. 文字列メソッドを使用して、文字列内の母音を見つけて数えますか?
- 7. 文字列メソッドを使用して、文字列内の母音を見つけて数えますか?
- 8. SQL:各母音の番号を文字列で別々に数える方法
- 9. 文字列内の最初の母音のインデックスを見つける
- 10. 別の文字列の後の文字列を見つける
- 11. 3つの母音を持つ文字列の部分文字列の数
- 12. 文字列内の母音の数を調べる方法は?
- 13. 文字列の最後の文字列を見つける方法
- 14. anglejsの最後の文字で文字列を見つける方法は?
- 15. 文字列j番目の文字列の2番目の部分文字列に分割文字列
- 16. 文字列の最初の文字と最初の母音を見つけるjava
- 17. 文字列内の文字のn番目の出現箇所を見つけて置換する方法は?
- 18. 文字列の部分文字列を見つける方法
- 19. 文字列の母音と子音を数えます。
- 20. 文字の後に最初の文字列を見つける
- 21. ファンクションラッパーのない文字列の母音の数を数える方法
- 22. cの文字列中の文字列のインデックスを見つける方法は?
- 23. Rプログラミング - 例えば第一及び括弧内の2番目の文字列
- 24. Mips:文字列の2番目の文字を取得する方法
- 25. grepで2文字間の文字列を見つける
- 26. Regex - 2つの文字列の間の文字列を見つけるPHP
- 27. 文字列内の母音だけを印刷する
- 28. 2つまたは3つの母音を持つMongoDBクエリ文字列
- 29. Pythonで文字列の色表現文字列を見つける方法は?
- 30. 多くの文字列の中で文字列を見つける方法
あなたはあなたがしようとしているもののいくつかの例を提供する場合、それは素晴らしいことだ、でもそれは、人々が質問に答えると、あなたの理解を高めるのに役立ちますように、その完全に間違っている場合。 – miltonb
詳細については、http://stackoverflow.com/q/36978101/641067を参照してください。 – brettdj