time and value question

Deanius

New Member
Joined
Mar 12, 2017
Messages
14
Hi All, Thanks for any help on this one.

I have a a number of daily logs that show a percentage toner in my cartridge. The percentage falls as i use it over time. I want to be able to see when the cartridge was replaced. But sometimes people can take the cartridge out and shake so the value goes back up to 100% over a few days then goes back to its actual value. EG 15,14,14,13,13,13,12,100,100,100,10,9,9,8,100,100,99,98,97

So i'd like a way of counting if the value is not a shake of the bottle at 12 and only counts one when it is a replacement 8 then 100,100,99,98,97

Thanks hope that makes sense.

Dean
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
ask producent of this machine for technical codes and you'll see everything. it doesn't matter people shaking cartidge or not
 
Upvote 0
ask producent of this machine for technical codes and you'll see everything. it doesn't matter people shaking cartidge or not

Thanks but i'm getting the data from the SNMP and i'd like to look at old data so i need to have a formula to do it now.
 
Upvote 0
Not sure this is exactly what you want, but :-
Assuming your data string is in "A1" then try this (lightly tested) for results in "A2".

Code:
[COLOR="Navy"]Sub[/COLOR] MG17Feb40
[COLOR="Navy"]Dim[/COLOR] Sp [COLOR="Navy"]As[/COLOR] Variant, txt [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]String,[/COLOR] n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
Sp = Split([a1], ",")
[COLOR="Navy"]For[/COLOR] n = 0 To UBound(Sp)
   [COLOR="Navy"]If[/COLOR] n < UBound(Sp) [COLOR="Navy"]Then[/COLOR]
    [COLOR="Navy"]If[/COLOR] Sp(n) <> 8 And Sp(n + 1) = 100 And Not Sp(n) = 100 [COLOR="Navy"]Then[/COLOR]
         txt = txt & IIf(txt = "", Sp(n), "," & Sp(n))
        [COLOR="Navy"]Do[/COLOR] [COLOR="Navy"]While[/COLOR] Sp(n + 1) = 100
            n = n + 1
         [COLOR="Navy"]Loop[/COLOR]
     [COLOR="Navy"]Else[/COLOR]
        txt = txt & IIf(txt = "", Sp(n), "," & Sp(n))
    [COLOR="Navy"]End[/COLOR] If
   [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR] n
[COLOR="Navy"]If[/COLOR] Not Sp(UBound(Sp)) = 100 And Sp(UBound(Sp) - 1) <> 100 [COLOR="Navy"]Then[/COLOR]
    txt = txt & "," & Sp(UBound(Sp))
[COLOR="Navy"]End[/COLOR] If
[a2] = txt
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,206
Members
453,022
Latest member
RobertV1609

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top