Page 1
Page 1
Started By
Message

Microsoft Excel Help with Formula (Updated with Picture of Spreadsheet)

Posted on 6/1/14 at 1:31 pm
Posted by OleWarSkuleAlum
Huntsville, AL
Member since Dec 2013
10293 posts
Posted on 6/1/14 at 1:31 pm
I am trying to make a cell that will populate the date with the last time I input "NG" into column D where column A houses the date. I also want another cell to populate with the amount of days from the last aforementioned cell until present day. Does this make sense?

TIA
This post was edited on 6/1/14 at 8:57 pm
Posted by Brettesaurus Rex
Baton Rouge
Member since Dec 2009
38259 posts
Posted on 6/1/14 at 1:41 pm to
It took me a few times to understand what you were trying to say....but try this

=if(D="NG",A,"")
This will give you that date in A.

To do the difference in days, try this:
=today()-A
Posted by OleWarSkuleAlum
Huntsville, AL
Member since Dec 2013
10293 posts
Posted on 6/1/14 at 8:49 pm to
Thank you for the extremely quick response to better clarify my situation I've included a picture...

Exactly what I want to do is: in another cell from D262:D999999 filter the most recent occurance of "NG". I want in that cell it to populate the date of that most recent occurance as shown in A.

So in this picture the most recent occurance of "NG" is 29-May-14, I want 29-May-14 to populate in the cell of my choosing based on D262:D999999.
Posted by OleWarSkuleAlum
Huntsville, AL
Member since Dec 2013
10293 posts
Posted on 6/1/14 at 8:55 pm to
quote:

=if(D="NG",A,"")
This will give you that date in A.


Unfortunately this formula did not work.
Posted by Volvagia
Fort Worth
Member since Mar 2006
51907 posts
Posted on 6/1/14 at 9:41 pm to
=LOOKUP(NG,D262:D99999,A262:A9999)

=TODAY()-(=LOOKUP(NG,D262:D99999,A262:A9999))


This is off the top of my head, so you may have some formatting tweaking, but this should get you on the right track





Posted by LSU Tigerhead
Metairie
Member since Nov 2007
4961 posts
Posted on 6/1/14 at 11:17 pm to
I don't think that will work because the values in the lookup column D have to be sorted in ascending order.

EDIT:
Try this:

=MAX(if(D262:D999999="NG", A262:A999999))
This post was edited on 6/1/14 at 11:40 pm
Posted by Volvagia
Fort Worth
Member since Mar 2006
51907 posts
Posted on 6/1/14 at 11:26 pm to
Hmmmm...you might be right.



Now to play in Excel.
Posted by CubsFanBudMan
Member since Jul 2008
5071 posts
Posted on 6/2/14 at 9:45 am to
Try this

=LOOKUP(2,1/(D262:D999999="NG"),A262:A999999)
This post was edited on 6/2/14 at 10:05 am
Posted by LSUtigerME
Walker, LA
Member since Oct 2012
3796 posts
Posted on 6/2/14 at 11:36 am to
Are you against using a simple Macro?

Would be fairly easy with a macro/do while loop.

Basically use Do While loop to progress down each row until empty (assume no empty rows in worksheet), check if D column is equal to "NG", then store date from column A, overwriting previous entry. If A is sorted ascending, it'll store the latest date.

I'm on my phone, so I can't help much with syntax.
Posted by OleWarSkuleAlum
Huntsville, AL
Member since Dec 2013
10293 posts
Posted on 6/2/14 at 9:02 pm to
Stupid me the formula CubsFanBudMan gave me worked perfectly!! I just needed to format the cell to show the date instead of numbers.

The formula =LOOKUP(2,1/(D262:D999999="NG"),A262:A999999) is 100% correct

=TODAY()-(LOOKUP2,1/(D262:D999999="NG"),A262:A999999) shows the difference in days.
This post was edited on 6/2/14 at 9:15 pm
Posted by OleWarSkuleAlum
Huntsville, AL
Member since Dec 2013
10293 posts
Posted on 6/2/14 at 9:18 pm to
As far as macros I just thoroughly confused myself going through the Microsoft Excel macro training online. What would be the benefit of a macro versus a formula?
Posted by LSUtigerME
Walker, LA
Member since Oct 2012
3796 posts
Posted on 6/3/14 at 12:28 am to
There's lots of different benefits.

Formulas are typically simpler and easier to share. Some workstations won't allow macros to be run, or at least give a security warning.

The advantage is you have a ton of options and much more robust programming. It's basically coding a "program" into your worksheet. For this situation, it seems like a formula is simple enough. But others often require a macro to execute the desired functionality.

In this example, you could write a code that starts at row #1, compares the column "D" if equal to "NG". If true, it'll store the date from column A. Then it'll progress to the next row, and repeat. This will happen until all rows are complete, and you're left with the last "NG" and respective date. You could also use this functionality to write an entire worksheet of only the "NG" data, or only "NG" data occurring in "May", etc. Although this specific example may been done with filters, macros could automate the process.

This loop functionality is very beneficial and can take advantage of a lot of the functionality of excel. There's a ton of uses for it and some more advanced programming, including input forms, form controls, etc. it requires a little bit of coding logic knowledge to write an efficient code, but it's very useful.
first pageprev pagePage 1 of 1Next pagelast page
refresh

Back to top
logoFollow TigerDroppings for LSU Football News
Follow us on Twitter, Facebook and Instagram to get the latest updates on LSU Football and Recruiting.

FacebookTwitterInstagram