You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

📰 Apple Fitness+ unveils an exciting lineup of new ways to stay active and mindful in 2025

Offerings include new programs for strength, pickleball, yoga, and breath meditation, and a new collaboration with Strava. Learn more >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Numbers formulae issues

Greetings all,


I'm relatively new to programming in Numbers (or excel for that matter), so was wondering if someone could give me a hand with the syntax for the following problem. I am a pilot and I'm trying to create my own logbook to record my flying hours. I'd like to create a formulae that allows me to calculate how many hours i've flown within the last 30 days. The table below is the main entry table, and I am trying to use the following but it doesn't seem to be working:


=IF((Entries :: Table 1 :: A<NOW()-30),SUM(Entries :: Table 1 :: K4:P14),0)


Any suggestions would be greatly appreciated


Greg


User uploaded file

iMac (21.5-inch Mid 2011), OS X Mountain Lion

Posted on Jul 26, 2012 4:58 AM

Reply
Question marked as Top-ranking reply

Posted on Jul 26, 2012 6:06 AM

Hi Greg,


It can be challenging to work with dates and times in spreadsheets. And, Numbers treats these values differently than Excel does, so any background in Excel can work against you.


Here's my first suggestion: Take the 30-day math out of the formula and put it in a separate table/cell. Then, just refer to that cell. NOW() - 30 will be the same for every reference in the document, so it doesn't need to appear on every line. Further, I would use TODAY rather than NOW unless you are splitting hairs.


So, you could have a 1-cell table named "Minus30" and refer to it.


Also, if your calculation is in the same table and on the same row as the data you are referring to, you don't need the Sheet and Table names in the reference. Then your expression would simplify to:


=IF(A < Minus30 :: A1, SUM(Table 1 :: K4:P14),0)


Or something close to that. I haven't actually tested, but I will if you think we're going in the proper direction. I'm a bit confused as to where this expression resides.


Jerry

3 replies
Question marked as Top-ranking reply

Jul 26, 2012 6:06 AM in response to Greg Bird 74

Hi Greg,


It can be challenging to work with dates and times in spreadsheets. And, Numbers treats these values differently than Excel does, so any background in Excel can work against you.


Here's my first suggestion: Take the 30-day math out of the formula and put it in a separate table/cell. Then, just refer to that cell. NOW() - 30 will be the same for every reference in the document, so it doesn't need to appear on every line. Further, I would use TODAY rather than NOW unless you are splitting hairs.


So, you could have a 1-cell table named "Minus30" and refer to it.


Also, if your calculation is in the same table and on the same row as the data you are referring to, you don't need the Sheet and Table names in the reference. Then your expression would simplify to:


=IF(A < Minus30 :: A1, SUM(Table 1 :: K4:P14),0)


Or something close to that. I haven't actually tested, but I will if you think we're going in the proper direction. I'm a bit confused as to where this expression resides.


Jerry

Jul 26, 2012 10:37 AM in response to Greg Bird 74

Hi Greg,


You're looking to SUM the values in six columns that are associated with dates in Column A which are on or after the date 30 days ago. For your example set, the sum is 1.1 hours, as only the flight on July 25 this year fits the conditions.

User uploaded file

Syntax for SUMIF is: =SUMIF(test-values, condition, sum-values)


Test values are the values in Log::A (all values in non-header rows in this column—rows 4 - 16 in my example)


Condition: the value must be later (greater than) or on (equal to) the date in Last 30 Days::A2. The condition must be expressed as a text string.


Sum values: The range containing the sum values must be the same size as the range containing the test values. Since you have only one column of test values, you will need one iteration of SUMIF for each column of flying hour values.


Here's the SUMIF for column M, the only column containing flying hour values in the sample data:


=SUMIF(Log :: A,">="&$A$2,Log :: M)


The full formula, placed in B2 of the small table, uses SUM and six iterations of the SUMIF above:


Last 30 Days::B2:

=SUM(SUMIF(Log :: A,">="&$A$2,Log :: K),SUMIF(Log :: A,">="&$A$2,Log :: L),SUMIF(Log :: A,">="&$A$2,Log :: M),SUMIF(Log :: A,">="&$A$2,Log :: N),SUMIF(Log :: A,">="&$A$2,Log :: O),SUMIF(Log :: A,">="&$A$2,Log :: P))


The starting date for the 30 day period, shown in A2, uses this formula:


Last 30 Days:A2: =TODAY()-30


Regards,

Barry

Jul 27, 2012 6:00 AM in response to Barry

Thanks very much to Barry and Jerry for their responses.


I've tried to look online for a 'numbers for Dummies' type book but had no success, so your assistance has been invaluable. I've taken Barry's advice and it seems to work well. So thanks for your time in responding. Its people like the two of you that make these forums work so well.


Cheers


Greg

Numbers formulae issues

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.