VBA to pull text out of cell

helpexcel

Well-known Member
Joined
Oct 21, 2009
Messages
656
Hi - Is there a way to say look in A10 and if the word "March" appears, put "March" in B10?

Thanks!
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
How about
=IF(ISNUMBER(SEARCH("March",A10)),"March","")
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0
how would i incorporate that into a sumif? and can i us a reference list? So if text in A10:A30 contains a month the month is shown in B10:B30
 
Upvote 0
I don't understand what you are asking.

Can you please post some data, along with an explanation of what you are trying to do & sample results.
 
Upvote 0
I have data in Column A that includes text, which also has the month. I'm trying to sum by month, with the months listed in column B.

Data In Out
In January 1 January 1 January 0
In March 2 February 0 February 4
In April 3 March 2 March 0
Out February 4 April 3 April 0
Out June 5 May 0 May 0
In July 6 June 0 June 5
July 6 July 0
August 0 August 0
September 0 September 0
October 0 October 0
November 0 November 0
December 0 December 0
 
Upvote 0
Column A Column B Column C
[TABLE="width: 560"]
<tbody>[TR]
[TD]Data[/TD]
[TD][/TD]
[TD][/TD]
[TD]In[/TD]
[TD][/TD]
[TD][/TD]
[TD]Out[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]In January[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD]January[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD]January[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]In March[/TD]
[TD="align: right"]2[/TD]
[TD][/TD]
[TD]February[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD]February[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD]In April[/TD]
[TD="align: right"]3[/TD]
[TD][/TD]
[TD]March[/TD]
[TD="align: right"]2[/TD]
[TD][/TD]
[TD]March[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Out February[/TD]
[TD="align: right"]4[/TD]
[TD][/TD]
[TD]April[/TD]
[TD="align: right"]3[/TD]
[TD][/TD]
[TD]April[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Out June[/TD]
[TD="align: right"]5[/TD]
[TD][/TD]
[TD]May[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD]May[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]In July[/TD]
[TD="align: right"]6[/TD]
[TD][/TD]
[TD]June[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD]June[/TD]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]July[/TD]
[TD="align: right"]6[/TD]
[TD][/TD]
[TD]July[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]August[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD]August[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]September[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD]September[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]October[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD]October[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]November[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD]November[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]December[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD]December[/TD]
[TD="align: right"]0[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
Upvote 0
Whilst that is better, it's still not clear what is in which column, you say cols A,B 7 C, but it looks like you have 6 columns.
Also I cannot see where those numbers come from, or what you are trying to sum.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top