cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
EmilyT
Level II

formula to add one to previous dependent on another column

Hi all,

 

I know my subject is a little convoluted sounding, but I'm thinking this must be something fairly simple to do and I'm just not knowledgeable enough to know how...

 

I have attached an example of my data. I would like to write a formula for my "Daynight consecutive" column to have it populate the field with a unique number according to the date (in the "date" column) and whether it is day or night (in the "day or night" column). (This is for me to use in the calculations of "Average Day Temperature" and "Average Night Temperature"). The actual number that is in there doesn't actually matter.  I just want a unique identifier for the the period of day or night for each date. But it isn't as simple as combining the "date" and "day or night" columns because the night period spans over two dates.

 

Hope that makes sense....the example file hopefully illustrates it.  I've manually entered the values in "Daynight consecutive" but would be really helpful if I could use a formula to create that column.

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions

Re: formula to add one to previous dependent on another column

If you can rely on the row order always being sorted by time, this would work:

 Screenshot 2024-01-03 155123.png

 Modified dataset attached.

View solution in original post

2 REPLIES 2

Re: formula to add one to previous dependent on another column

If you can rely on the row order always being sorted by time, this would work:

 Screenshot 2024-01-03 155123.png

 Modified dataset attached.

EmilyT
Level II

Re: formula to add one to previous dependent on another column

Thank you!  This worked great and has saved me lots of time!