Flagging increases in values when a certain criteria is met

MrSak87

New Member
Joined
Jan 8, 2015
Messages
44
Hi all,

I use this site often but I'm usually able to find a solution to my problem through your threads, but not this time so it's my first post.

Essentially I have huge amounts of lab data and have been automatically generating a testing schedule from it using a small macro but most calculations come from the formula bar. My problem is for a certain test a criteria must be met for it to be performed. i.e

Column A Column B Column C Column D
[TABLE="width: 500"]
<tbody>[TR]
[TD]P1[/TD]
[TD]0[/TD]
[TD]0.78[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]P1B1[/TD]
[TD]0[/TD]
[TD]0.2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]P1Q1[/TD]
[TD]0.2[/TD]
[TD]0.4[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]P1U1[/TD]
[TD]0.4[/TD]
[TD]0.6[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]P1B2[/TD]
[TD]0.6[/TD]
[TD]0.78[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]P2[/TD]
[TD]1[/TD]
[TD]1.64[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]P2B1[/TD]
[TD]1[/TD]
[TD]1.2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]P2B2[/TD]
[TD]1.2[/TD]
[TD]1.4[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]P2Q1[/TD]
[TD]1.4[/TD]
[TD]1.64[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]P3[/TD]
[TD]2[/TD]
[TD]2.64[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]



For every 1.5 increase (column B and C is just a start and end) I want excel in column D to write an X next to it so in the example above the "X" would appear at row "P2Q1". Normally this would be quite easy but the P1, P2, P3 show the start and end of the whole sample so whatever solution is found needs to only include subsamples P1B1,P1Q1 etc and ignore full samples P1, P2, P3.

My explanation is awful I know but hopefully you can see what I'm tying to do!! Any help would be much appreciated!
 
[TABLE="width: 313"]
<tbody>[TR]
[TD]P1[/TD]
[TD][/TD]
[TD][/T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][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
So with the above only the x's are important. They should automatically appear at 1.4-1.64, 3-3.2, 4.4-4.6 and whatever the first P7 value will be...
 
Upvote 0
Apologies, just saw your post earlier - "basically every 1.5 increase from 0 needs to be flagged somehow. so 0, 1.5, 3, 4.5 etc"
 
Upvote 0
OK, try the following

In Cell D2 enter
=IF(LEN(A2)=2,D1,(ROUNDDOWN(C2/1.5,0)*1.5))

In Cell E2 enter
=IF(D2=D1,"","X")

Copy both down full range.
 
Upvote 0
Gaz you are a genius! I've had to make a few tweaks because I needed the real values of column D, so I've just added a hidden column and copied pretty much exactly what you've done.

Thankyou!!!!!!!!!!!!!
 
Upvote 0
Just a thought, if your "whole samples" go beyond P9, you may have to tweak the formula "LEN(A2)=2" to accommodate!
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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