in column d2:d4000 i have a combination of seven numbers how can i highlight the odd numbers

d2= 3,6,9,11,21,32,41

Yes, it can be done with a simple macro:

Sub ColorizeOddValues
Dim oSheet As Variant, oCell As Variant, oText As Variant, oTCursor As Variant
Dim sString As String, aString As Variant, iVal As Integer
Dim i As Long, j As Integer, iStartPos As Integer 
	oSheet = ThisComponent.getCurrentSelection().getSpreadsheet()
	For i = 1 To 3999	' Enumerate all cells from row 2 to row 4000
		oCell = oSheet.getCellByPosition(3, i)	' ...in column 3 (D)
		oText = oCell.getText()
		sString = oText.getString()	
		If Trim(sString) <> "" Then	' If cell not is empty
			aString = Split(sString, ",")	' Enumerate all values in string
			iStartPos = 0
			For j = LBound(aString) To UBound(aString)
				iVal = CInt(Trim(aString(j)))
				If iVal mod 2 = 1 Then ' If next number is odd
					oTCursor = oText.createTextCursor()	' select it with TextCursor
					oTCursor.gotoStart(False)
					If oTCursor.goRight(iStartPos, False) Then 
						If oTCursor.goRight(Len(aString(j)), True) Then	' and colorize it
							oTCursor.CharWeight = 150
							oTCursor.CharColor = RGB(0,0,255)
							oTCursor.CharBackColor = RGB(0,255,0)
						EndIf 
					EndIf 
				EndIf 
				iStartPos = iStartPos + Len(aString(j) + 1	' Shift StartPos to next value
			Next j
        End If
	Next i
End Sub

How it works you can see in this small demo - HighlightOdd.ods

[EDIT]

Sorry, my answer is not appropriate for your particular case as @JohnSUN rightly pointed out. I keep it however for the more general case.

Hi

You can also apply a conditional format:

  • Select the range
  • FormatConditional FormattingCondition
  • Condition1: select Formula is and type the formula ISODD(D2)
  • Select a style to apply▸Ok

Regards

A good idea, but for his data it will not work. Look, at it all numbers for the analysis “even or odd” are in a string in one cell. :frowning: That is, he first needs to break his line into seven separate columns and apply conditional formatting to them

@JohnSUN Damned ! reading the question too fast indeed, very sorry :frowning:

Regards

Don’t worry, my friend, your answer was an absolutely correct answer to the question in the title of the topic (without taking into account the clarification in the body of the message). If someone is looking for a solution to their problem, your answer can help him. Please, restore your answer - it will be useful to other people.

right once again @JohnSUN

thank’s