Hi. I am trying to create a formula which would display a date (prior to the computer's system time) when a certain amount of text occurs.
I have attached my workbook with an example and further explanation.
Hi. I am trying to create a formula which would display a date (prior to the computer's system time) when a certain amount of text occurs.
I have attached my workbook with an example and further explanation.
Hi, try this
C1: =IF(AND(B1="a",COUNTIF($B$1:B1,"a")=3,A1<TODAY()),A1,"")
Copy C1 and copy it down the column. You should see the formulas like this:
C2: =IF(AND(B2="a",COUNTIF($B$1:B2,"a")=3,A2<TODAY()),A2,"")
C3: =IF(AND(B3="a",COUNTIF($B$1:B3,"a")=3,A3<TODAY()),A3,"")
... etc
This will show the date from column A only when both conditions are met, the 3rd 'a' occurs and the date in column A is less than the current date.
Cheers
<-- If you're happy & you know it...click the star.:-)
Thanks, but I would only like to have 1 formula which would count the occurrence of a's in a range of cells (B1:B7), instead of just one cell (B1).
Is this possible?
Try this.......
Is this what you want?![]()
Please Login or Register to view this content.
Regards
sktneer
Treat people the way you want to be treated. Talk to people the way you want to be talked to.
Respect is earned NOT given.
Unfortunately, that formula displays the computer's system time.
I need the formula to display the date (from column A) when the 3rd "a" occurs prior to the computer's system time.
Do you want this output?
Copy it down as far as it is needed.![]()
Please Login or Register to view this content.
That formula, like the one in post #2, also looks at one row of cells (A1 and B1).
The formula should look at a range of cells (A1:A7 and B1:B7).
Do you want the formula to display date when the 3rd occurrence of "a" took place very first time in the range? Or you want formula to display date of column A every time when it finds every 3rd occurrence of "a" in column B? I think you are not able to explain your requirement well.
It would be better if you upload a sample workbook with two sheets, Before and After. Where in the Before sheet you just simply put some sample data and in After sheet, you put the complete desired output applicable to the whole data set of Before sheet.
The formula I gave you will look the first 3rd occurrence of "a" in col. B and then display the corresponding col. A date in corresponding cell in col. C. Then it goes further and once it finds next 3rd occurrence of "a" in col. B, it displays the corresponding col. A date in the corresponding cell in col. C.
Was that not your requirement?
jhudson444 - finding the 1st instance of a text is easy using VLookup(). But finding the 2nd, 3rd,..., nth instance is a little complicated.
If you want all the calculation to take place in one cell, then using a macro/VBA code would be the best and easiest way.
But if you don't mind the calculation spread over a few cells, try using the attached excel.
You'll see that I've moved the columns around (A has become B and B has become A) to make the VLookup work.
Let me know if this works for you.
Cheers
Yes, I want the formula to display the date of column A every time it finds every 3rd occurrence of "a" in column B (it should display the first date of occurrence prior to the computer's date).
Yes, I would like the calculation to take place in one cell. I don't know how to use a macro/VBA code.
I've attached a new workbook with 4 sheets to better explain what the formula should do. I hope this helps. Thanks for trying to help, everyone.
Last edited by jhudson444; 11-10-2013 at 07:37 PM.
try this UDF (User Defined Function) i created:
How to install your new code![]()
Please Login or Register to view this content.
- Copy the Excel VBA code
- Select the workbook in which you want to store the Excel VBA code
- Press Alt+F11 to open the Visual Basic Editor
- Choose Insert > Module
- Edit > Paste the macro into the module that appeared
- Close the VBEditor
- Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)
To run the Excel VBA code:
the arguments i placed for this function are the Range required, to count what text, and how many times you require the count to be
so that means in Sheet1, i used:
=GetDate(A1:A7,"a",3)
if it's always "a" & 3 counts, you can use this:
then just:![]()
Please Login or Register to view this content.
=GetDate2(A1:A7)
i am always interested in non-VBA ways, so let me ask if someone awesome can help chip in.
ps: you have to enable macros if you try my file
Thanks, if you have clicked on the * and added our rep.
If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".
"Contentment is not the fulfillment of what you want, but the realization of what you already have."
Tips & Tutorials I Compiled | How to Get Quick & Good Answers
I lol for this idea i had.
helper column for character count then multiple if statement for index /sumproduct (last entry,2nd to last,3rd to last...) .
look attachment.
jhudsonvlad.xlsx
I think people forget the word "THANK YOU!!!!" Do you still know it???
There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "
Regards,
Vladimir
I was unable to get your function to work (I enabled macros when I opened your workbook).
This formula worked to calculate a correct date:
This formula worked to calculate 2 months (with the first day of the month) after that correct date:![]()
Please Login or Register to view this content.
Two issues:![]()
Please Login or Register to view this content.
1. Is there a way to make the first formula work without needing a "helper column"?
2. Is there a way to combine these two formulas?
I've attached a modified workbook (see orange/yellow highlight on sheet 1).
I can't think a way NOT to have the helper column there, you can hide the column or use other column that is far from those data say column Z.
to combine the two formula
=EOMONTH(the first long formula here,2)+1
BTW the UDF works fine on my side.. and it's shorter.
a shorter version provided by our friends. BUT still with the helper there.
array..
Formula:
Please Login or Register to view this content.
hope someone could help further analyze on applying a formula without helper column.
Ok, thanks for the help.
The problem with the helper column is that I don't want to make an entry into column C every time I make an entry into column B.
Hopefully, someone can figure out how to modify the first formula in post #13 (or just create an entirely new formula) to not include a helper column.
using post #13 formula
array entered i came up with this without helper column.
Formula:
Please Login or Register to view this content.
edited above::: due to last statement c1:c9
you can include your eof the just as in post #14
i don't know if I can do it in offset though. post #15
the helper cells are formulas no need to enter then just drag them all the way down as you want.I don't want to make an entry into column C every time I make an entry into column B
Last edited by vlady; 11-12-2013 at 10:26 PM.
Thanks!
The formula now counts the occurrence of any text in column B. Is there a way to make it count the occurrence of specific text (count "a" or "b")?
look below attachment
jhudsonvlad3rd.xlsx
Thank you!
Two more things, and I think my problem will be solved:
1. Can you tell me how to modify the formula to look for 6 occurrences (>=6) instead of 3?
2. Can you tell me how to make the formula also look for "b"?
Last edited by jhudson444; 11-14-2013 at 06:50 PM.
Array formula (note: this formula has a limit to how much text it can index before "Formula is too long" error occurs -- I think up to "e" or "f" is as much as it can index):
Thanks for the help, everyone!![]()
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks