• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Indexing the number

sachar

Member
Dear All,

With reference to the attach sample file, the [column “A”] Text contained the words like: “Tax”, “Service” and “Tips” on that basis, I would like to give the number 1=Tax, 2=Service, 3=Tips in the next [column “c”]

Please help me to sort out my problems?
 

Attachments

  • trial_balance11-12-16_sample file.xlsx
    11.4 KB · Views: 15
One More option. Put this in cell I1 and then copy drag down:

=COUNTIF($A$1:$A$78,"*" & H1 & "*")

Or, if you create a table with your data called Charge_Names you can do this:
=COUNTIF(Charge_Names,"*" & H1 & "*")
The advantage of using a named table is that when you add data, the total counts will be updated.
 
Hi:

Another Option:
=IFERROR(LOOKUP(2^15,SEARCH($H$1:$H$3,A1),$I$1:$I$3),"")

Thanks
 

Attachments

  • trial_balance11-12-16_sample file.xlsx
    12.4 KB · Views: 6
Can you talk through how this works ?
Hi,
Using Binary Search and Bignum of MATCH function to find the position of the last value within a given ref.

In this example

=IFERROR(4-MATCH(99,SEARCH({"tips";"service ";"tax"},A1)),"")

In here, "99" is the Bignum and you can use the biggest number 9.9999999999999E+307 instead.

>>

=IFERROR(4-MATCH(99,{#VALUE!;16;#VALUE!}),"")

By the Binary Search of MATCH, it will give the position of the last value

>>

=IFERROR(4-2,"")

"2" is the position of the last value.

>>

=2

Desired result.


Edit : Since, the Binary search is searching bottom-up, the using of 4-MATCH(…..) is to meet with the OP's required order.

Regards
Bosco
 
One More option. Put this in cell I1 and then copy drag down:

=COUNTIF($A$1:$A$78,"*" & H1 & "*")

Or, if you create a table with your data called Charge_Names you can do this:
=COUNTIF(Charge_Names,"*" & H1 & "*")
The advantage of using a named table is that when you add data, the total counts will be updated.
I read your issue wrong. Please disregard this. Sorry for the confusion
 
Back
Top