If values in Column C = specific text, insert specific text into a value in Column G

john5599

Board Regular
Joined
Mar 11, 2010
Messages
222
Sir I have an excel sheet with 4000 rows like below, I would like to add some text in Col. as in sample chart. If column C Value start Bill No.... then I need Column G as invoice.
How it possible with Formula and Macro.
I have a Listed of Text Add in col G.

List1
Invoice
Sales Return
Cash Transfer
Discount
Cash Received
Cash Received

<tbody>
</tbody>


Excel 2007
ABCDEFG
2DateCustomer NameNarrationAmountCash RecivedCheque Recived
305/12/2012Madan PuraBill No.156515000 Invoice
405/12/2012Jerry Pvt. LtdBill No.145610000 Invoice
505/12/2012Jackson Pvt. LtdBill No.145825000 Invoice
605/12/2012Jackson Pvt. LtdCash Received25000Cash Received
718/12/2012Jackson Pvt. LtdCheque Received1800Cheque Received
805/12/2013Varun AssociatesCash Received By 5000Cash Received
905/12/2012George Peter GroupsBill No.178010300 Invoice
1005/12/2012Vikram AssociatesBill No.18631050Invoice
1115/05/2012Jerry Pvt. LtdBill No.18341000Invoice
1215/05/2012Rupa & CompanyBill No.1865750Invoice
1315/05/2012Mruthula & Co.Bill No.1890400Invoice
1416/05/2012Rupa & CompanyCash Transfer to Bank A/C7000Cash Transfer
1515/05/2012Varun AssociatesBill No.1925700Invoice
1615/05/2012Rupa & CompanyBill No.18968000Invoice
1712/06/2012Jackson Pvt. LtdSales return1800 Sales Return
1825/07/2012Jackson Pvt. LtdCash Transfer3600Cash Transfer
1918/08/2012Jackson Pvt. LtdGoods Return360Sales Return
2018/05/2013Jackson Pvt. LtdDiscount Given350Discount Given
2120/05/2013Mahesh & SonsCash T/F to Bank1200Cash Transfer
2220/05/2013George Peter GroupsCheque Received12000Cheque Received
2310/06/2013George Peter GroupsGoods Return985Sales Return

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
I think this is what you intend, but you will need to ne consistent with data entry in column C. Entries 14 and 21 should be the same but one is entered with abbreviation.

Excel Workbook
ABCDEFGHI
2Bill NoBill NoInvoice
3Sales rSales returnSales Return
4Cash TrCash Transfer to Bank A/CCash Transfer
5DiscounDiscount GivenDiscount
6Cash ReCash ReceivedCash Received
7ChequeCheque ReceivedCheque Received
8
9
10
11ABCDEFG
12DateCustomer NameNarrationAmountCash RecivedCheque Recived
135/12/2012Madan PuraBill No.156515000InvoiceInvoice
145/12/2012Jerry Pvt. LtdBill No.145610000InvoiceInvoice
155/12/2012Jackson Pvt. LtdBill No.145825000InvoiceInvoice
165/12/2012Jackson Pvt. LtdCash Received25000Cash ReceivedCash Received
Sheet18
 
Upvote 0
Sir, First I am giving a great thanks for your kind help.
Sir I have one doubt, If possible, Can you explain the formula.,$A$2:$C$7,3,FALSE. What is meaning of 3 in the formula.

Regards
 
Upvote 0
Sir, First I am giving a great thanks for your kind help.
Sir I have one doubt, If possible, Can you explain the formula.,$A$2:$C$7,3,FALSE. What is meaning of 3 in the formula.

Regards

Thanks for your comments.

The VLOOKUP function H13 =VLOOKUP(LEFT(C13,7),$A$2:$C$7,3,FALSE) has 4 parameters.
In this example, the first parameter is the lookup value. Here it is LEFT(C13,7) that returns the first 7 letters of the description in C13.
The second parameter (A2:C7) specifies a range where to look. The function will find the lookup value in the first column of the range.
The third parameter (3) refers to the third column of the lookup range.
The last parameter (FALSE) is required because the lookup range is not sorted and you want an exact match in the first column, not an approximate match.
The function will find the lookup value in column A and then return the contents of the 3rd column of the range (column C) of the same row.

I had to use LEFT function because all of the invoice lines start "Bill No" then end with a different number.
Because you have cash received and cash transfer the LEFT returns 7 characters.
 
Last edited:
Upvote 0
Thanks for your comments.

The VLOOKUP function H13 =VLOOKUP(LEFT(C13,7),$A$2:$C$7,3,FALSE) has 4 parameters.
In this example, the first parameter is the lookup value. Here it is LEFT(C13,7) that returns the first 7 letters of the description in C13.
The second parameter (A2:C7) specifies a range where to look. The function will find the lookup value in the first column of the range.
The third parameter (3) refers to the third column of the lookup range.
The last parameter (FALSE) is required because the lookup range is not sorted and you want an exact match in the first column, not an approximate match.
The function will find the lookup value in column A and then return the contents of the 3rd column of the range (column C) of the same row.

I had to use LEFT function because all of the invoice lines start "Bill No" then end with a different number.

Because you have cash received and cash transfer the LEFT returns 7 characters.

Thank you so much your kind explanation Sir.
 
Upvote 0

Forum statistics

Threads
1,221,417
Messages
6,159,789
Members
451,589
Latest member
Harold14

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