Finding certain words in a cell and return a value based off the word found.
Solved/Closed
shanej69
Posts
1
Registration date
Sunday July 25, 2021
Status
Member
Last seen
July 25, 2021
-
Jul 25, 2021 at 06:17 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Jul 26, 2021 at 11:37 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Jul 26, 2021 at 11:37 AM
Related:
- If cell contains a certain word then return value
- If cell contains specific word then return value - Best answers
- If a cell contains a certain word then return value - Best answers
- If cell contains date then return value ✓ - Office Software Forum
- If a cell has text then return value ✓ - Excel Forum
- Excel: If Date =, then enter a value ✓ - Excel Forum
- Excel "IF" function w/ date in test cell ✓ - Excel Forum
- Excel formula to check if cell contains a date - Excel Forum
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Jul 26, 2021 at 11:37 AM
Jul 26, 2021 at 11:37 AM
Hi Shanj69,
Your example shows a pattern, column B shows the first letter of the text in column A. This can be achieved by using the following formula:
=LEFT(A2,1)
Drag the formula down for the rest of the cells.
If this is not on purpose, then you can use a nested IF formula like:
=IF(A2="Apple","A",IF(A2="Banana","B",""))
Or add to this code:
Best regards,
Trowa
Your example shows a pattern, column B shows the first letter of the text in column A. This can be achieved by using the following formula:
=LEFT(A2,1)
Drag the formula down for the rest of the cells.
If this is not on purpose, then you can use a nested IF formula like:
=IF(A2="Apple","A",IF(A2="Banana","B",""))
Or add to this code:
Sub RunMe() For Each cell In Range("A2:A" & Range("A" & Rows.Count).End(xlUp).Row) If cell.Value = "Apple" Then cell.Offset(0, 1).Value = "A" If cell.Value = "Banana" Then cell.Offset(0, 1).Value = "B" Next cell End Sub
Best regards,
Trowa